forked from fa/breadcrumb-the-shire
Add a new Software-Produkte feature to the helpdesk module that syncs contract types (Create_SaaS_License=true) from BC OData into a local database table with a nightly scheduler job, providing a Grid.js list page and detail/edit page for managing custom product names. - DB migration 003: helpdesk_software_products table (code UNIQUE key) - BcODataGateway: FS_Contract_Types entity with SaaS filter + fallback - SoftwareProductRepository: upsert, listPaged, softDelete, updateName - SoftwareProductSyncService: fetch → upsert → soft-delete lifecycle - SoftwareProductSyncJobHandler: daily at 02:00 via scheduler platform - SoftwareProductService: web UI business logic with validation - Permission: helpdesk.software-products.manage (nav-gated) - List page: Grid.js with Code, BC Description, Name, Status columns - Detail page: Code/BC Description read-only, Name editable, PRG pattern - i18n: de + en translation keys Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
40 lines
1.6 KiB
PHP
40 lines
1.6 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();
|
|
} catch (\Throwable) {
|
|
$canManageSettings = false;
|
|
$canViewTeam = false;
|
|
$canViewRiskRadar = false;
|
|
$canManageSoftwareProducts = false;
|
|
}
|
|
|
|
return ['helpdesk.nav' => [
|
|
'can_manage_settings' => $canManageSettings,
|
|
'can_view_team' => $canViewTeam,
|
|
'can_view_risk_radar' => $canViewRiskRadar,
|
|
'can_manage_software_products' => $canManageSoftwareProducts,
|
|
]];
|
|
}
|
|
}
|