feat: enhance admin role management and reconciliation features
- Updated AGENTS.md to clarify site admin roles and their associated permissions. - Refactored reconciliation controllers to include admin user validation and improved access control based on admin roles. - Enhanced AdminReconcileJobService to support player-specific reconciliation and site-based job creation. - Removed deprecated rebate commission report functionality from the API and related services. - Improved dashboard overview builders to accommodate new site operator roles and their specific functionalities.
This commit is contained in:
@@ -40,6 +40,7 @@ final class AdminAuthProfile
|
||||
* },
|
||||
* site: ?array{id: int, code: string, name: string},
|
||||
* is_super_admin: bool,
|
||||
* account_kind: 'super_admin'|'site_admin'|'site_finance'|'site_cs'|'agent_operator'|'platform_account',
|
||||
* operational_permissions: list<string>,
|
||||
* delegation_ceiling: list<string>,
|
||||
* accessible_sites?: list<array{id: int, code: string, name: string}>
|
||||
@@ -49,6 +50,7 @@ final class AdminAuthProfile
|
||||
{
|
||||
$fresh = $admin->fresh();
|
||||
$permissionSlugs = $fresh->adminPermissionSlugs();
|
||||
$operationalCodes = $fresh->effectiveMenuActionPermissionCodes();
|
||||
$agent = self::agentContext($fresh);
|
||||
|
||||
$payload = [
|
||||
@@ -61,7 +63,8 @@ final class AdminAuthProfile
|
||||
'agent' => $agent,
|
||||
'site' => self::siteContext($fresh),
|
||||
'is_super_admin' => $fresh->isSuperAdmin(),
|
||||
'operational_permissions' => $permissionSlugs,
|
||||
'account_kind' => self::accountKind($fresh),
|
||||
'operational_permissions' => $operationalCodes,
|
||||
'delegation_ceiling' => AgentDelegationAuthorization::delegationLegacySlugsForAdminUser($fresh),
|
||||
];
|
||||
|
||||
@@ -81,7 +84,7 @@ final class AdminAuthProfile
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! SitePlatformRole::userHasSiteAdminRole($admin)) {
|
||||
if (! SiteOperatorRoles::userHasSiteOperatorRole($admin)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -130,4 +133,22 @@ final class AdminAuthProfile
|
||||
'can_create_player' => (bool) ($profile?->can_create_player ?? false),
|
||||
];
|
||||
}
|
||||
|
||||
private static function accountKind(AdminUser $admin): string
|
||||
{
|
||||
if ($admin->isSuperAdmin()) {
|
||||
return 'super_admin';
|
||||
}
|
||||
|
||||
if ($admin->hasPrimaryAgentBinding()) {
|
||||
return 'agent_operator';
|
||||
}
|
||||
|
||||
$siteRole = SiteOperatorRoles::primarySiteOperatorSlug($admin);
|
||||
if ($siteRole !== null) {
|
||||
return $siteRole;
|
||||
}
|
||||
|
||||
return 'platform_account';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user