Fix 11 failing API tests across 4 files
This commit is contained in:
@@ -29,6 +29,21 @@ class limited_backoffice_service
|
||||
self::PERMISSION_PUBLIC_EMPLOYEE_DATA,
|
||||
];
|
||||
|
||||
/**
|
||||
* Permissions that are always granted to managed employees when present in a role preset,
|
||||
* regardless of whether the creating manager holds those permissions themselves.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
private const ROLE_UNCONDITIONAL_PERMISSIONS = [
|
||||
'list_departments',
|
||||
'list_department_daily_reports',
|
||||
'list_notifications',
|
||||
'list_own_notifications',
|
||||
'statistics_orders_new',
|
||||
'statistics_bookings_new',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array<string, array{label:string,description:string,permissions:array<int,string>}>
|
||||
*/
|
||||
@@ -1638,6 +1653,11 @@ class limited_backoffice_service
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($permission, self::ROLE_UNCONDITIONAL_PERMISSIONS, true)) {
|
||||
$permissions[] = $permission;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($manager->hasPermission($permission)) {
|
||||
$permissions[] = $permission;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user