fix(helpdesk): replace Guard::hasAbility() with AuthorizationService in create wizard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
aminovfariz
2026-06-01 14:38:02 +02:00
parent c32a0f8c31
commit 3f56f3f279

View File

@@ -7,6 +7,7 @@ use MintyPHP\Module\Helpdesk\HelpdeskAuthorizationPolicy;
use MintyPHP\Module\Helpdesk\Service\HandoverService;
use MintyPHP\Module\Helpdesk\Service\SoftwareProductService;
use MintyPHP\Router;
use MintyPHP\Service\Access\AuthorizationService;
use MintyPHP\Session;
use MintyPHP\Support\Flash;
use MintyPHP\Support\Guard;
@@ -19,8 +20,6 @@ $returnTarget = requestResolveReturnTarget('helpdesk/handovers');
$closeTarget = requestResolveReturnTarget('helpdesk/handovers');
$createTarget = requestPathWithReturnTarget('helpdesk/handovers/create', $returnTarget);
$canManage = Guard::hasAbility(HelpdeskAuthorizationPolicy::ABILITY_HANDOVERS_MANAGE);
$step = (int) $request->query('step', '1');
if ($step < 1 || $step > 2) {
$step = 1;
@@ -33,6 +32,10 @@ $sessionStore = app(SessionStoreInterface::class);
$appSession = $sessionStore->all();
$sessionKey = 'module.helpdesk.handover_create';
$authService = app(AuthorizationService::class);
$userId0 = (int) ($appSession['user']['id'] ?? 0);
$canManage = $authService->authorize(HelpdeskAuthorizationPolicy::ABILITY_HANDOVERS_MANAGE, ['actor_user_id' => $userId0])->isAllowed();
// ── Step 1: Select debitor + product ─────────────────────────────────
if ($step === 1) {