- Added `priority`-based access logic to restrict role and user management actions. - Introduced `Permission Manager` UI and routes for permission access control. - Updated `RoleService` and `AppRoleService` to include `visible` scope for priority filtering. - Enhanced seeding to assign priorities to default roles and ensure proper hierarchy. - Updated sidebar, routes, and data structure to handle new permission enums and resource segmentation. - Improved UI components to dynamically restrict visibility and actions based on role priority.
Permissions Enums
This directory contains all the permissions enums. Spatie/laravel-permission uses these enums to check permissions. Any Permission enum added here will be automatically added to the database, when the PermissionSeeder is run, no need to add it manually. This is done via Reflection API.
Only string backed are supported.
Value format of Enum
We are following the convention of scope:resource:action .
File name of the enum should be same as the scope name, and Enum value should be in the format of resource:action.
Example: UserPermissionEnum.php
namespace App\Enums\Permissions;
enum UserPermissionEnum:string
{
case Create = 'user:create';
case Read = 'user:read';
case Update = 'user:update';
case Delete = 'user:delete';
}
// using the enum makes straight forward permission check
$user->can(UserPermissionEnum::Create);
@can(UserPermissionEnum::Create);