feat(admin): 更新后台权限管理与同步逻辑,简化权限检查并优化文档
- 新增后台 RBAC 相关文档,提供权限目录与维护命令说明。 - 移除不必要的角色资源同步检查,简化权限审计命令。 - 更新权限描述与同步逻辑,确保一致性与可维护性。 - 统一权限注册表,替换过时的权限别名,增强代码可读性。
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Database\Seeders\AdminRbacAndUserSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
@@ -49,27 +48,3 @@ test('admin authorization sync can repair registry-backed api resources and pass
|
||||
|
||||
expect($bindingCount)->toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test('admin authorization audit detects role api resource drift', function (): void {
|
||||
$this->seed(AdminRbacAndUserSeeder::class);
|
||||
|
||||
$resourceId = DB::table('admin_api_resources')
|
||||
->where('code', 'admin.audit.index')
|
||||
->value('id');
|
||||
|
||||
$roleId = DB::table('admin_roles')
|
||||
->where('slug', 'finance')
|
||||
->value('id');
|
||||
|
||||
expect($resourceId)->not->toBeNull();
|
||||
expect($roleId)->not->toBeNull();
|
||||
|
||||
DB::table('admin_role_api_resources')
|
||||
->where('role_id', (int) $roleId)
|
||||
->where('api_resource_id', (int) $resourceId)
|
||||
->delete();
|
||||
|
||||
$this->artisan('lottery:admin-auth-audit --skip-route-coverage')
|
||||
->expectsOutputToContain('Missing role-resource grant')
|
||||
->assertExitCode(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user