Add order bookings functionality with permissions and access control
- Introduced `order_bookings_o` class for interacting with the `order_bookings` database table. - Added `hasDepartmentAccess` method to handle department-level permissions. - Implemented new routes for creating and retrieving order bookings, including pagination support. - Enhanced access control to differentiate between own and departmental bookings based on permissions. - Updated input validation and improved error handling for order bookings.
This commit is contained in:
@@ -217,6 +217,18 @@ trait route_t
|
||||
self::requirePermission('department_access_' . $department . ($permission ? '_' . $permission : ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Has department access?
|
||||
* @note This checks if the user has access to the department by checking if the user has the permission department_access_{department} (_{permission} if provided)
|
||||
* @param string $department
|
||||
* @param string|null $permission
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDepartmentAccess(string $department, string|null $permission = null): bool
|
||||
{
|
||||
return self::hasPermission('department_access_' . $department . ($permission ? '_' . $permission : ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Require permission
|
||||
* @param string $permission
|
||||
|
||||
Reference in New Issue
Block a user