forked from fa/breadcrumb-the-shire
feat(helpdesk): align module with core list/drawer standards
- 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
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?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]];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user