feat: refactor super admin to use is_super_admin flag and enhance site deletion logic

- Changed super admin detection from role-based to `is_super_admin` flag in AdminUser model
- Added `requireDefaultAdminSiteId()` method to throw validation error when no integration site exists
- Enhanced site deletion to migrate platform role bindings to fallback site and auto-delete site-specific admin accounts
- Made agent line code optional with auto-generation fallback using `{site_code}-agent-{counter}` format
This commit is contained in:
2026-06-12 20:47:40 +08:00
parent 980f3c9593
commit 395e1c7400
36 changed files with 1193 additions and 153 deletions

View File

@@ -11,6 +11,10 @@ return [
'site_access_denied' => 'You do not have access to this site.',
'site_rotate_denied' => 'You cannot rotate secrets for this site.',
'site_update_denied' => 'You cannot modify this site.',
'site_delete_denied' => 'You cannot delete this site.',
'integration_site_default_delete_denied' => 'The default site cannot be deleted.',
'integration_site_last_delete_denied' => 'At least one integration site must remain; the last site cannot be deleted.',
'no_integration_site' => 'Create an integration site first.',
'site_player_access_denied' => 'You do not have access to players under this site.',
'player_create_site_forbidden' => 'You cannot create players under this site.',
'player_create_agent_required' => 'A player must belong to an agent node. Choose a valid site with an agent root, or sign in with an agent-bound account.',
@@ -39,6 +43,7 @@ return [
'user_cannot_delete_self' => 'Cannot delete your own account.',
'user_cannot_delete_last_super_admin' => 'Cannot delete the last super admin.',
'super_admin_only_for_roles' => 'Only super admins can manage roles.',
'super_admin_not_site_role' => 'Super admin is a single platform account and cannot be assigned as a site role.',
'route_name_missing_for_permission' => 'Admin route is missing a route name for permission checks.',
'api_resource_not_configured' => 'Admin API resource is not configured: :route',
'api_resource_no_permission_binding' => 'Admin API resource has no permission binding: :code',