feat: granular permissions, export backup, user/role management
- PermissionSeeder: 29 permissions with role mapping (admin/manager/staff) - Policies updated to use hasPermissionTo() instead of hasRole() - ExportBackup command: JSON per-table backup with chunk processing - UserResource: CRUD users with role assignment (admin only) - RoleResource: CRUD roles with permission assignment (admin only) - UserPolicy + RolePolicy: admin-only access control - ImportCskh: detailed skip logging with color in dry-run mode - Widgets: permission-based visibility checks - Tests: 8/8 pass (21 assertions)
This commit is contained in:
@@ -9,27 +9,27 @@ class CustomerPolicy
|
||||
{
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->hasRole(['admin', 'manager', 'staff']);
|
||||
return $user->hasPermissionTo('view-customer');
|
||||
}
|
||||
|
||||
public function view(User $user, Customer $customer): bool
|
||||
{
|
||||
return $user->hasRole(['admin', 'manager', 'staff']);
|
||||
return $user->hasPermissionTo('view-customer');
|
||||
}
|
||||
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->hasRole(['admin', 'manager']);
|
||||
return $user->hasPermissionTo('create-customer');
|
||||
}
|
||||
|
||||
public function update(User $user, Customer $customer): bool
|
||||
{
|
||||
return $user->hasRole(['admin', 'manager']);
|
||||
return $user->hasPermissionTo('update-customer');
|
||||
}
|
||||
|
||||
public function delete(User $user, Customer $customer): bool
|
||||
{
|
||||
return $user->hasRole('admin');
|
||||
return $user->hasPermissionTo('delete-customer');
|
||||
}
|
||||
|
||||
public function restore(User $user, Customer $customer): bool
|
||||
|
||||
Reference in New Issue
Block a user