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:
@@ -17,7 +17,7 @@ use App\Support\AdminDataScope;
|
||||
use App\Support\AdminScopeContext;
|
||||
use App\Support\AdminAgentScope;
|
||||
use App\Support\AdminScopeContextResolver;
|
||||
use App\Support\SitePlatformRole;
|
||||
use App\Support\SiteOperatorRoles;
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
|
||||
/**
|
||||
@@ -32,6 +32,8 @@ final class AdminDashboardSnapshotBuilder
|
||||
private readonly AdminReportQueryService $reportQuery,
|
||||
private readonly AgentDashboardOverviewBuilder $agentOverview,
|
||||
private readonly SiteDashboardOverviewBuilder $siteOverview,
|
||||
private readonly SiteFinanceDashboardOverviewBuilder $siteFinanceOverview,
|
||||
private readonly SiteCsDashboardOverviewBuilder $siteCsOverview,
|
||||
) {}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
@@ -60,12 +62,19 @@ final class AdminDashboardSnapshotBuilder
|
||||
],
|
||||
'agent_overview' => null,
|
||||
'site_overview' => null,
|
||||
'site_finance_overview' => null,
|
||||
'site_cs_overview' => null,
|
||||
];
|
||||
|
||||
if ($admin->primaryAgentNode() !== null) {
|
||||
$out['agent_overview'] = $this->agentOverview->build($admin);
|
||||
} elseif (SitePlatformRole::userHasSiteAdminRole($admin)) {
|
||||
$out['site_overview'] = $this->siteOverview->build($admin, $scope);
|
||||
} elseif (SiteOperatorRoles::userHasSiteOperatorRole($admin)) {
|
||||
$operatorSlug = SiteOperatorRoles::primarySiteOperatorSlug($admin);
|
||||
match ($operatorSlug) {
|
||||
SiteOperatorRoles::SLUG_SITE_FINANCE => $out['site_finance_overview'] = $this->siteFinanceOverview->build($admin, $scope),
|
||||
SiteOperatorRoles::SLUG_SITE_CS => $out['site_cs_overview'] = $this->siteCsOverview->build($admin),
|
||||
default => $out['site_overview'] = $this->siteOverview->build($admin, $scope),
|
||||
};
|
||||
}
|
||||
|
||||
if ($canDraw) {
|
||||
|
||||
Reference in New Issue
Block a user