From 3a3a49e881931472788d079b432901a9d63b345e Mon Sep 17 00:00:00 2001 From: marcelmanzel Date: Tue, 30 Jul 2024 12:38:43 +0200 Subject: [PATCH] OXDEV-8215: Add separate permissions for listing themes and modules --- src/Module/Controller/ModuleListController.php | 2 +- src/Theme/Controller/ThemeListController.php | 2 +- tests/Unit/Shared/Service/PermissionProviderTest.php | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Module/Controller/ModuleListController.php b/src/Module/Controller/ModuleListController.php index 264cede..dd1f962 100644 --- a/src/Module/Controller/ModuleListController.php +++ b/src/Module/Controller/ModuleListController.php @@ -29,7 +29,7 @@ public function __construct( */ #[Query] #[Logged] - #[Right('CHANGE_CONFIGURATION')] + #[Right('LIST_MODULES')] public function modulesList(?ModuleFilters $filters = null): array { return $this->moduleListService->getModuleList($filters ?? new ModuleFilters()); diff --git a/src/Theme/Controller/ThemeListController.php b/src/Theme/Controller/ThemeListController.php index cfe0f0c..fc21dcb 100644 --- a/src/Theme/Controller/ThemeListController.php +++ b/src/Theme/Controller/ThemeListController.php @@ -30,7 +30,7 @@ public function __construct( */ #[Query] #[Logged] - #[Right('CHANGE_CONFIGURATION')] + #[Right('LIST_THEMES')] public function themesList(?ThemeFilters $filters): array { return $this->themeListService->getThemeList($filters ?? new ThemeFilters()); diff --git a/tests/Unit/Shared/Service/PermissionProviderTest.php b/tests/Unit/Shared/Service/PermissionProviderTest.php index cb3962c..a433c78 100644 --- a/tests/Unit/Shared/Service/PermissionProviderTest.php +++ b/tests/Unit/Shared/Service/PermissionProviderTest.php @@ -18,7 +18,9 @@ public function testGetPermissions(): void { $expectedPermissions = [ 'oxidadmin' => [ - 'CHANGE_CONFIGURATION' + 'CHANGE_CONFIGURATION', + 'LIST_THEMES', + 'LIST_MODULES' ], ];