From dddc698405a9ffc6d0a76ca1f0dd75a1d4a31f5c Mon Sep 17 00:00:00 2001 From: Spitfire Date: Fri, 8 Dec 2023 15:12:52 -0600 Subject: [PATCH 1/2] Roles entity list sorted alphabetically --- .../Permissions/RolePermissionService.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/Services/Permissions/RolePermissionService.php b/app/Services/Permissions/RolePermissionService.php index daf0f48bef..c832dd80c5 100644 --- a/app/Services/Permissions/RolePermissionService.php +++ b/app/Services/Permissions/RolePermissionService.php @@ -72,14 +72,14 @@ public function permissions(): array foreach (EntityType::get() as $entityType) { foreach ($entityActions as $action) { - if (!isset($permissions[$entityType->id])) { - $permissions[$entityType->id] = [ + if (!isset($permissions[$entityType->plural()])) { + $permissions[$entityType->plural()] = [ 'entityType' => $entityType, 'permissions' => [] ]; } $key = "{$entityType->id}_{$action}"; - $permissions[$entityType->id]['permissions'][] = [ + $permissions[$entityType->plural()]['permissions'][] = [ 'action' => $action, 'key' => $key, 'icon' => Arr::first($icons[$action]), @@ -89,7 +89,16 @@ public function permissions(): array } } - return $permissions; + $collator = new \Collator(app()->getLocale()); + $collator->asort($permissions); + + $keys = array_keys($permissions); + $collator->sort($keys); + foreach ($keys as $key) { + $result[$key] = $permissions[$key]; + } + + return $result; } /** * Campaign Permissions From f88bbe97a9921c372b19544d4d145ddbb9b235fa Mon Sep 17 00:00:00 2001 From: spitfire305 Date: Fri, 8 Dec 2023 21:14:42 +0000 Subject: [PATCH 2/2] Fix styling --- app/Services/Attributes/TemplateService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/Attributes/TemplateService.php b/app/Services/Attributes/TemplateService.php index 66ca112671..8c88b8fff2 100644 --- a/app/Services/Attributes/TemplateService.php +++ b/app/Services/Attributes/TemplateService.php @@ -15,8 +15,8 @@ class TemplateService { - use EntityAware; use CampaignAware; + use EntityAware; protected RandomService $randomService;