forked from fa/breadcrumb-the-shire
- add helpdesk module pages, services, settings and tests - standardize debtor list on drawer/grid contracts and robust filter drawer behavior - add helpdesk aside panel navigation and settings visibility provider - switch primary list slug to helpdesk/debitor and remove helpdesk/search compatibility - include required core contract updates for list contracts and detail/drawer integration
30 lines
949 B
PHP
30 lines
949 B
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);
|
|
$canManageSettings = $authorizationService->authorize('helpdesk.settings.manage', [
|
|
'actor_user_id' => $userId,
|
|
])->isAllowed();
|
|
} catch (\Throwable) {
|
|
$canManageSettings = false;
|
|
}
|
|
|
|
return ['helpdesk.nav' => ['can_manage_settings' => $canManageSettings]];
|
|
}
|
|
}
|