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:
@@ -2,12 +2,15 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Admin\Reconcile;
|
||||
|
||||
use App\Models\AdminSite;
|
||||
use App\Models\AdminUser;
|
||||
use App\Models\TransferOrder;
|
||||
use App\Models\ReconcileJob;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\ReconcileItem;
|
||||
use App\Support\AdminAgentScope;
|
||||
use App\Support\AdminApiList;
|
||||
use App\Support\AdminReconcileScope;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Support\AdminTransferOrderCapabilities;
|
||||
@@ -28,11 +31,27 @@ final class ReconcileItemIndexController extends Controller
|
||||
$admin = $request->lotteryAdmin();
|
||||
abort_if($admin === null, 401);
|
||||
|
||||
if ($denied = AdminReconcileScope::denyUnlessJobAccessible($admin, $reconcile_job)) {
|
||||
return $denied;
|
||||
}
|
||||
|
||||
$p = AdminApiList::readPaging($request, 50, 200);
|
||||
|
||||
$paginator = $reconcile_job->items()
|
||||
->orderBy('id')
|
||||
->paginate($p['perPage'], ['*'], 'page', $p['page']);
|
||||
$itemsQuery = $reconcile_job->items()->orderBy('id');
|
||||
if (! $admin->isSuperAdmin()) {
|
||||
$siteIds = $admin->accessibleAdminSiteIds() ?? [];
|
||||
$siteCodes = $siteIds === []
|
||||
? []
|
||||
: AdminSite::query()
|
||||
->whereIn('id', $siteIds)
|
||||
->pluck('code')
|
||||
->map(static fn ($code): string => (string) $code)
|
||||
->all();
|
||||
$agent = AdminAgentScope::primaryAgentNode($admin);
|
||||
AdminReconcileScope::applyItemsTransferPlayerScope($itemsQuery, $siteCodes, $agent);
|
||||
}
|
||||
|
||||
$paginator = $itemsQuery->paginate($p['perPage'], ['*'], 'page', $p['page']);
|
||||
|
||||
$transferNos = collect($paginator->items())
|
||||
->map(fn (ReconcileItem $item) => $item->side_a_ref)
|
||||
|
||||
Reference in New Issue
Block a user