Skip to content

Commit

Permalink
Merge branch '2.x-release/v2.2.4' into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
themodernpk committed Jan 22, 2024
2 parents 38bd749 + 3a57ce1 commit a6811c1
Show file tree
Hide file tree
Showing 86 changed files with 2,404 additions and 1,870 deletions.
2 changes: 1 addition & 1 deletion Config/vaahcms.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$settings = [
'app_name' => 'VaahCMS',
'app_slug' => 'vaahcms',
'version' => '2.2.3',
'version' => '2.2.4',
'php_version_required' => '8.1',
'get_config_version' => false,
'website' => 'https://vaah.dev/cms',
Expand Down
14 changes: 7 additions & 7 deletions Database/Seeders/json/language_strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@
"locale_code_iso_639": "en",
"category": "dashboard",
"name": "Welcome to VaahCms",
"content": "Welcome to VaahCms"
"content": "Welcome to Vaah<b>Cms</b>"
},
{
"locale_code_iso_639": "en",
Expand Down Expand Up @@ -870,7 +870,7 @@
"locale_code_iso_639": "en",
"category": "dashboard",
"name": "Run Jobs",
"content": "Enable Laravel Queues to run your jobs"
"content": "Enable <b>Laravel Queues</b> to run your jobs"
},
{
"locale_code_iso_639": "en",
Expand Down Expand Up @@ -3627,7 +3627,7 @@
"locale_code_iso_639": "es",
"category": "dashboard",
"name": "Welcome to VaahCms",
"content": "Bienvenido a VaahCms"
"content": "Bienvenido a Vaah<b>Cms</b>"
},
{
"locale_code_iso_639": "es",
Expand Down Expand Up @@ -3736,7 +3736,7 @@
"locale_code_iso_639": "es",
"category": "dashboard",
"name": "Run Jobs",
"content": "Habilite Laravel Queues para ejecutar sus trabajos"
"content": "Habilite <b>Laravel Queues</b> para ejecutar sus trabajos"
},
{
"locale_code_iso_639": "es",
Expand Down Expand Up @@ -6293,7 +6293,7 @@
"locale_code_iso_639": "fr",
"category": "login",
"name": "Email or Username Limit",
"content": "L'e-mail ou le nom d\\'utilisateur ne doit pas dépasser 150 caractères."
"content": "L\\'e-mail ou le nom d\\'utilisateur ne doit pas dépasser 150 caractères."
},
{
"locale_code_iso_639": "fr",
Expand Down Expand Up @@ -6493,7 +6493,7 @@
"locale_code_iso_639": "fr",
"category": "dashboard",
"name": "Welcome to VaahCms",
"content": "Bienvenue sur VaahCms"
"content": "Bienvenue sur Vaah<b>Cms</b>"
},
{
"locale_code_iso_639": "fr",
Expand Down Expand Up @@ -6601,7 +6601,7 @@
"locale_code_iso_639": "fr",
"category": "dashboard",
"name": "Run Jobs",
"content": "Activez les files d\\'attente Laravel pour exécuter vos tâches"
"content": "Activez les <b>files d\\'attente Laravel</b> pour exécuter vos tâches"
},
{
"locale_code_iso_639": "fr",
Expand Down
14 changes: 7 additions & 7 deletions Database/Seeders/json/permissions.json
Original file line number Diff line number Diff line change
Expand Up @@ -429,43 +429,43 @@
{
"name": "Has Access Of Taxonomies Section",
"module": "vaahcms",
"section": "user",
"section": "taxonomy",
"details": "This will allow user to see the link of taxonomy section."
},
{
"name": "Can Create Taxonomies",
"module": "vaahcms",
"section": "user",
"section": "taxonomy",
"details": "This will allow user to add anything in the taxonomy section."
},
{
"name": "Can Read Taxonomies",
"module": "vaahcms",
"section": "user",
"section": "taxonomy",
"details": "This will allow user to view anything in the taxonomy section."
},
{
"name": "Can Update Taxonomies",
"module": "vaahcms",
"section": "user",
"section": "taxonomy",
"details": "This will allow user to edit anything in the taxonomy section."
},
{
"name": "Can Delete Taxonomies",
"module": "vaahcms",
"section": "user",
"section": "taxonomy",
"details": "This will allow user to delete anything in the taxonomy section."
},
{
"name": "Can Manage Taxonomies",
"module": "vaahcms",
"section": "user",
"section": "taxonomy",
"details": "This will allow user to manage anything in the taxonomy section."
},
{
"name": "Can Manage Taxonomy Types",
"module": "vaahcms",
"section": "user",
"section": "taxonomy",
"details": "This will allow user to manage anything in the taxonomy type modal."
}
]
14 changes: 14 additions & 0 deletions Helpers/backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,19 @@ function vh_get_backend_file($file_path)
return vh_get_backend_theme_url()."/".$file_path;
}
//-----------------------------------------------------------------------------------
function vh_get_permission_denied_json_response($permission_slugs){
$response = vh_get_permission_denied_response($permission_slugs);
return response()->json($response);
}
//-----------------------------------------------------------------------------------
function vh_get_permission_denied_response($permission_slugs){
$response = [];
$response['success'] = false;

$response['errors'][] = trans("vaahcms-general.permission_denied");
if(env('APP_DEBUG')){
$response['hint'][] = 'You don\'t have "'.$permission_slugs.'" permission.';
}
return $response;
}
//-----------------------------------------------------------------------------------
14 changes: 6 additions & 8 deletions Http/Controllers/Backend/Advanced/BatchesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ public function __construct()
//----------------------------------------------------------
public function getAssets(Request $request): JsonResponse
{
if (!Auth::user()->hasPermission('has-access-of-advanced-section')) {
$response['success'] = false;
$response['errors'][] = trans("vaahcms::messages.permission_denied");
$permission_slug = 'has-access-of-advanced-section';

return response()->json($response);
if(!Auth::user()->hasPermission($permission_slug)) {
return vh_get_permission_denied_json_response($permission_slug);
}

try {
Expand Down Expand Up @@ -68,11 +67,10 @@ public function getAssets(Request $request): JsonResponse
//----------------------------------------------------------
public function getList(Request $request): JsonResponse
{
if (!Auth::user()->hasPermission('has-access-of-batches-section')) {
$response['success'] = false;
$response['errors'][] = trans("vaahcms::messages.permission_denied");
$permission_slug = 'has-access-of-batches-section';

return response()->json($response);
if(!Auth::user()->hasPermission($permission_slug)) {
return vh_get_permission_denied_json_response($permission_slug);
}

try {
Expand Down
15 changes: 7 additions & 8 deletions Http/Controllers/Backend/Advanced/FailedJobsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ public function __construct()
//----------------------------------------------------------
public function getAssets(Request $request): JsonResponse
{
if (!Auth::user()->hasPermission('has-access-of-advanced-section')) {
$response['success'] = false;
$response['errors'][] = trans("vaahcms::messages.permission_denied");
$permission_slug = 'has-access-of-advanced-section';

return response()->json($response);
if(!Auth::user()->hasPermission($permission_slug)) {
return vh_get_permission_denied_json_response($permission_slug);
}

try {
Expand Down Expand Up @@ -68,12 +67,12 @@ public function getAssets(Request $request): JsonResponse
//----------------------------------------------------------
public function getList(Request $request): JsonResponse
{
if (!Auth::user()->hasPermission('has-access-of-failed-jobs-section')) {
$response['success'] = false;
$response['errors'][] = trans("vaahcms::messages.permission_denied");
$permission_slug = 'has-access-of-failed-jobs-section';

return response()->json($response);
if(!Auth::user()->hasPermission($permission_slug)) {
return vh_get_permission_denied_json_response($permission_slug);
}

try {
$response = FailedJob::getList($request);
} catch (\Exception $e) {
Expand Down
14 changes: 6 additions & 8 deletions Http/Controllers/Backend/Advanced/JobsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ public function __construct()
//----------------------------------------------------------
public function getAssets(Request $request): JsonResponse
{
if (!Auth::user()->hasPermission('has-access-of-advanced-section')) {
$response['success'] = false;
$response['errors'][] = trans("vaahcms::messages.permission_denied");
$permission_slug = 'has-access-of-advanced-section';

return response()->json($response);
if(!Auth::user()->hasPermission($permission_slug)) {
return vh_get_permission_denied_json_response($permission_slug);
}

try {
Expand Down Expand Up @@ -67,11 +66,10 @@ public function getAssets(Request $request): JsonResponse
//----------------------------------------------------------
public function getList(Request $request): JsonResponse
{
if (!Auth::user()->hasPermission('has-access-of-jobs-section')) {
$response['success'] = false;
$response['errors'][] = trans("vaahcms::messages.permission_denied");
$permission_slug = 'has-access-of-jobs-section';

return response()->json($response);
if(!Auth::user()->hasPermission($permission_slug)) {
return vh_get_permission_denied_json_response($permission_slug);
}

try {
Expand Down
36 changes: 15 additions & 21 deletions Http/Controllers/Backend/Advanced/LogsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ public function __construct()
//----------------------------------------------------------
public function getAssets(Request $request): JsonResponse
{
if (!Auth::user()->hasPermission('has-access-of-advanced-section')) {
$response['success'] = false;
$response['errors'][] = trans("vaahcms::messages.permission_denied");
$permission_slug = 'has-access-of-advanced-section';

return response()->json($response);
if(!Auth::user()->hasPermission($permission_slug)) {
return vh_get_permission_denied_json_response($permission_slug);
}

try {
Expand Down Expand Up @@ -69,11 +68,10 @@ public function getAssets(Request $request): JsonResponse
//----------------------------------------------------------
public function getList(Request $request): JsonResponse
{
if (!Auth::user()->hasPermission('has-access-of-logs-section')) {
$response['success'] = false;
$response['errors'][] = trans("vaahcms::messages.permission_denied");
$permission_slug = 'has-access-of-logs-section';

return response()->json($response);
if(!Auth::user()->hasPermission($permission_slug)) {
return vh_get_permission_denied_json_response($permission_slug);
}

try {
Expand Down Expand Up @@ -164,11 +162,10 @@ public function getList(Request $request): JsonResponse
//----------------------------------------------------------
public function getItem(Request $request, $name): JsonResponse
{
if (!Auth::user()->hasPermission('has-access-of-advanced-section')) {
$response['success'] = false;
$response['errors'][] = trans("vaahcms::messages.permission_denied");
$permission_slug = 'has-access-of-advanced-section';

return response()->json($response);
if(!Auth::user()->hasPermission($permission_slug)) {
return vh_get_permission_denied_json_response($permission_slug);
}

try {
Expand Down Expand Up @@ -230,11 +227,10 @@ public function getItem(Request $request, $name): JsonResponse
//----------------------------------------------------------
public function downloadFile(Request $request, $file_name): BinaryFileResponse | string | JsonResponse
{
if (!Auth::user()->hasPermission('has-access-of-advanced-section')) {
$response['success'] = false;
$response['errors'][] = trans("vaahcms::messages.permission_denied");
$permission_slug = 'has-access-of-advanced-section';

return response()->json($response);
if(!Auth::user()->hasPermission($permission_slug)) {
return vh_get_permission_denied_json_response($permission_slug);
}

try {
Expand Down Expand Up @@ -262,12 +258,10 @@ public function downloadFile(Request $request, $file_name): BinaryFileResponse |
//----------------------------------------------------------
public function postActions(Request $request, $action): JsonResponse
{
$permission_slug = 'has-access-of-advanced-section';

if (!Auth::user()->hasPermission('has-access-of-advanced-section')) {
$response['success'] = false;
$response['errors'][] = trans("vaahcms::messages.permission_denied");

return response()->json($response);
if(!Auth::user()->hasPermission($permission_slug)) {
return vh_get_permission_denied_json_response($permission_slug);
}

try {
Expand Down
Loading

0 comments on commit a6811c1

Please sign in to comment.