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',

View File

@@ -11,6 +11,10 @@ return [
'site_access_denied' => 'यो साइटमा पहुँच छैन।',
'site_rotate_denied' => 'यो साइटको गोप्यियता परिवर्तन गर्न मिल्दैन।',
'site_update_denied' => 'यो साइट सम्पादन गर्न मिल्दैन।',
'site_delete_denied' => 'यो साइट मेटाउन मिल्दैन।',
'integration_site_default_delete_denied' => 'पूर्वनिर्धारित साइट मेटाउन मिल्दैन।',
'integration_site_last_delete_denied' => 'कम्तीमा एउटा इन्टिग्रेशन साइट राख्नुपर्छ; अन्तिम साइट मेटाउन मिल्दैन।',
'no_integration_site' => 'पहिले इन्टिग्रेशन साइट सिर्जना गर्नुहोस्।',
'site_player_access_denied' => 'यो साइटका खेलाडीहरूमा पहुँच छैन।',
'player_create_site_forbidden' => 'यो साइटमा खेलाडी सिर्जना गर्न मिल्दैन।',
'player_create_agent_required' => 'खेलाडी एजेन्ट नोडमा हुनुपर्छ: मान्य साइट (एजेन्ट रुट सहित) छान्नुहोस्, वा एजेन्ट खाताबाट साइन इन गर्नुहोस्।',
@@ -39,6 +43,7 @@ return [
'user_cannot_delete_self' => 'आफ्नै खाता मेटाउन मिल्दैन।',
'user_cannot_delete_last_super_admin' => 'अन्तिम सुपर एडमिन मेटाउन मिल्दैन।',
'super_admin_only_for_roles' => 'भूमिका व्यवस्थापन केवल सुपर एडमिनले गर्न सक्छ।',
'super_admin_not_site_role' => 'सुपर एडमिन एक मात्र प्लेटफर्म खाता हो; साइट भूमिकाको रूपमा назнач गर्न मिल्दैन।',
'route_name_missing_for_permission' => 'एडमिन रुटमा route name छैन, अनुमति जाँच गर्न सकिँदैन।',
'api_resource_not_configured' => 'एडमिन API स्रोत कन्फिग गरिएको छैन: :route',
'api_resource_no_permission_binding' => 'एडमिन API स्रोतमा अनुमति बाइन्डिङ छैन: :code',

View File

@@ -11,6 +11,10 @@ return [
'site_access_denied' => '无权访问该站点。',
'site_rotate_denied' => '无权操作该站点。',
'site_update_denied' => '无权修改该站点。',
'site_delete_denied' => '无权删除该站点。',
'integration_site_default_delete_denied' => '默认站点不可删除。',
'integration_site_last_delete_denied' => '至少保留一个接入站点,无法删除最后一个站点。',
'no_integration_site' => '请先创建接入站点。',
'site_player_access_denied' => '无权访问该站点下的玩家。',
'integration_site_store_deprecated' => '请先在「平台配置 → 接入站点」创建站点,再在「代理配置 → 创建一级代理」绑定一级代理。',
'player_create_site_forbidden' => '无权在该站点下创建玩家。',
@@ -41,6 +45,7 @@ return [
'user_cannot_delete_self' => '不能删除当前登录账号。',
'user_cannot_delete_last_super_admin' => '不能删除最后一个超级管理员。',
'super_admin_only_for_roles' => '仅超级管理员可管理角色。',
'super_admin_not_site_role' => '超级管理员为平台唯一账号,不能通过站点角色分配。',
'route_name_missing_for_permission' => '后台路由缺少 route name无法执行资源鉴权。',
'api_resource_not_configured' => '后台 API 资源未配置::route',
'api_resource_no_permission_binding' => '后台 API 资源未绑定权限动作::code',