New Updates page in the Helpdesk module that fetches UPDATE/UPDATE-HF tickets from Business Central (PBI_LV_Tickets) and allows assigning a domain and Gitea link via a dialog. Ticket status (from BC) and assignment status (local) are shown as separate columns with filters for both plus type and free-text search. Assigned updates also appear on the domain detail page. Includes session-cached BC fetch with refresh button, admin permissions, migration, and 16 unit tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
52 lines
2.5 KiB
PHP
52 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace MintyPHP\Module\Helpdesk\Providers;
|
|
|
|
use MintyPHP\App\AppContainer;
|
|
use MintyPHP\App\Module\Contracts\LayoutContextProvider;
|
|
use MintyPHP\Service\Access\AuthorizationService;
|
|
|
|
final class HelpdeskLayoutProvider implements LayoutContextProvider
|
|
{
|
|
public function provide(array $session, AppContainer $container): array
|
|
{
|
|
$userId = (int) ($session['user']['id'] ?? 0);
|
|
if ($userId <= 0) {
|
|
return ['helpdesk.nav' => ['can_manage_settings' => false]];
|
|
}
|
|
|
|
try {
|
|
$authorizationService = $container->get(AuthorizationService::class);
|
|
$actorContext = ['actor_user_id' => $userId];
|
|
$canManageSettings = $authorizationService->authorize('helpdesk.settings.manage', $actorContext)->isAllowed();
|
|
$canViewTeam = $authorizationService->authorize('helpdesk.team-workload.view', $actorContext)->isAllowed();
|
|
$canViewRiskRadar = $authorizationService->authorize('helpdesk.risk-radar.view', $actorContext)->isAllowed();
|
|
$canManageSoftwareProducts = $authorizationService->authorize('helpdesk.software-products.manage', $actorContext)->isAllowed();
|
|
$canViewHandovers = $authorizationService->authorize('helpdesk.handovers.view', $actorContext)->isAllowed();
|
|
$canCreateHandovers = $authorizationService->authorize('helpdesk.handovers.create', $actorContext)->isAllowed();
|
|
$canManageHandovers = $authorizationService->authorize('helpdesk.handovers.manage', $actorContext)->isAllowed();
|
|
$canViewUpdates = $authorizationService->authorize('helpdesk.updates.view', $actorContext)->isAllowed();
|
|
} catch (\Throwable) {
|
|
$canManageSettings = false;
|
|
$canViewTeam = false;
|
|
$canViewRiskRadar = false;
|
|
$canManageSoftwareProducts = false;
|
|
$canViewHandovers = false;
|
|
$canCreateHandovers = false;
|
|
$canManageHandovers = false;
|
|
$canViewUpdates = false;
|
|
}
|
|
|
|
return ['helpdesk.nav' => [
|
|
'can_manage_settings' => $canManageSettings,
|
|
'can_view_team' => $canViewTeam,
|
|
'can_view_risk_radar' => $canViewRiskRadar,
|
|
'can_manage_software_products' => $canManageSoftwareProducts,
|
|
'can_view_handovers' => $canViewHandovers,
|
|
'can_create_handovers' => $canCreateHandovers,
|
|
'can_manage_handovers' => $canManageHandovers,
|
|
'can_view_updates' => $canViewUpdates,
|
|
]];
|
|
}
|
|
}
|