Add customer pricing permissions and update related tests

This commit is contained in:
Jeppe Bundgaard
2026-07-07 17:58:39 +02:00
parent 172a21c517
commit 084435e9b8
7 changed files with 115 additions and 11 deletions
@@ -11,6 +11,8 @@ function limited_backoffice_manager_session(array $departmentIds, array $extraPe
$permissions = [
limited_backoffice_service::PERMISSION_ACCESS,
limited_backoffice_service::PERMISSION_MANAGE_PRICES,
limited_backoffice_service::PERMISSION_VIEW_CUSTOMER_PRICING,
limited_backoffice_service::PERMISSION_MANAGE_CUSTOMER_PRICING,
limited_backoffice_service::PERMISSION_MANAGE_EMPLOYEES,
];
foreach ($departmentIds as $departmentId) {
@@ -77,6 +79,8 @@ function limited_backoffice_all_role_permissions(): array
'list_own_notifications',
'statistics_orders_new',
'statistics_bookings_new',
'limited_backoffice_customer_pricing_view',
'limited_backoffice_customer_pricing_manage',
];
}
@@ -879,6 +883,8 @@ it('creates updates lists and deactivates scoped employees without exposing raw
expect($departmentAdminGroups['limited_backoffice'] ?? null)->toBe([
'open_limited_backoffice',
'manage_department_prices',
'view_customer_pricing',
'manage_customer_pricing',
'manage_employee_access',
]);
expect($roles->body)->not->toContain('department_access_');
@@ -940,6 +946,8 @@ it('creates updates lists and deactivates scoped employees without exposing raw
'statistics_bookings_new',
'limited_backoffice_access',
'limited_backoffice_prices_manage',
'limited_backoffice_customer_pricing_view',
'limited_backoffice_customer_pricing_manage',
'limited_backoffice_employees_manage',
] as $rawPermission) {
expect($rolePayloadStrings)->not->toContain($rawPermission);
@@ -1654,6 +1662,13 @@ it('includes statistics_orders_new and statistics_bookings_new (Overblik) in all
}
});
it('includes customer pricing permissions in the department admin limited backoffice role preset', function (): void {
$permissions = limited_backoffice_role_preset_permissions('department_admin');
expect($permissions)
->toContain(limited_backoffice_service::PERMISSION_VIEW_CUSTOMER_PRICING)
->toContain(limited_backoffice_service::PERMISSION_MANAGE_CUSTOMER_PRICING);
});
it('assigns list_departments to managed employees and enforces list_departments permission on GET /departments', function (): void {
api_test_covers('GET /departments', 'limited backoffice employee');