fix(auth): grant customer role WRITE scopes for own data (TRU-149)

This commit is contained in:
Jeppe B
2026-08-17 13:28:19 +00:00
parent 9025a8af6e
commit cae91d6a11
+10 -2
View File
@@ -59,9 +59,17 @@ class Scope
self::INVOICE_READ, self::INVOICE_WRITE,
];
case 'customer':
// TRU-149 (fix): customers get WRITE on their own data so
// self-service endpoints (own vehicles, own subusers, own
// discount / security / notification settings, own bookings)
// work end-to-end. The existing fine-grained
// requirePermission() calls in each route still gate which
// specific actions are allowed — scope here only answers
// "can this caller write customer data at all".
return [
self::CUSTOMER_READ,
self::BOOKING_READ,
self::CUSTOMER_READ, self::CUSTOMER_WRITE,
self::BOOKING_READ, self::BOOKING_WRITE,
self::SUBUSER_READ, self::SUBUSER_WRITE,
self::INVOICE_READ,
];
case 'subuser':