2026-02-04 23:31:53 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use MintyPHP\Buffer;
|
2026-03-06 11:28:22 +01:00
|
|
|
use MintyPHP\Http\SessionStoreInterface;
|
2026-02-24 08:49:40 +01:00
|
|
|
use MintyPHP\Service\Access\SettingsAuthorizationPolicy;
|
2026-02-23 12:58:19 +01:00
|
|
|
use MintyPHP\Support\Guard;
|
2026-02-04 23:31:53 +01:00
|
|
|
|
2026-03-06 11:28:22 +01:00
|
|
|
$session = app(SessionStoreInterface::class)->all();
|
2026-02-04 23:31:53 +01:00
|
|
|
Guard::requireLogin();
|
2026-02-24 08:49:40 +01:00
|
|
|
|
2026-03-06 11:28:22 +01:00
|
|
|
$currentUserId = (int) ($session['user']['id'] ?? 0);
|
2026-03-04 15:56:58 +01:00
|
|
|
$authorizationService = app(\MintyPHP\Service\Access\AuthorizationService::class);
|
2026-02-24 08:49:40 +01:00
|
|
|
$viewDecision = $authorizationService->authorize(SettingsAuthorizationPolicy::ABILITY_ADMIN_SETTINGS_VIEW, [
|
|
|
|
|
'actor_user_id' => $currentUserId,
|
|
|
|
|
]);
|
|
|
|
|
if (!$viewDecision->isAllowed()) {
|
|
|
|
|
Guard::deny();
|
|
|
|
|
}
|
2026-02-04 23:31:53 +01:00
|
|
|
|
|
|
|
|
Buffer::set('title', t('Settings'));
|
2026-04-05 17:17:06 +02:00
|
|
|
|
|
|
|
|
$breadcrumbs = [
|
|
|
|
|
['label' => t('Home'), 'path' => 'admin'],
|
|
|
|
|
['label' => t('Settings')],
|
|
|
|
|
];
|