feat: initialize role-based access control (RBAC) system with multi-module UI and administrative management controllers

This commit is contained in:
Ajjj
2026-08-05 04:58:22 +08:00
parent 80fa96097c
commit 089e421716
19 changed files with 405 additions and 119 deletions

View File

@@ -93,12 +93,8 @@ class ContractorController extends Controller
'must_change_password' => true,
]);
// Provision the account with the role that owns user-management
// actions. Keep the legacy Contractor role only for existing
// accounts; new contractor admins must use the admin role.
$roleName = $contractor->parent_id
? 'Sub Contractor Admin'
: 'Main Contractor Admin';
// Provision every contractor administrator with the single supported contractor role.
$roleName = 'Main Contractor Admin';
$role = Role::firstOrCreate(['name' => $roleName]);
$role->givePermissionTo('users.access');
$user->assignRole($role);