29 lines
969 B
PHP
29 lines
969 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
use MintyPHP\Buffer;
|
||
|
|
use MintyPHP\Http\SessionStoreInterface;
|
||
|
|
use MintyPHP\Service\Access\SettingsAuthorizationPolicy;
|
||
|
|
use MintyPHP\Support\Guard;
|
||
|
|
|
||
|
|
$session = app(SessionStoreInterface::class)->all();
|
||
|
|
Guard::requireLogin();
|
||
|
|
|
||
|
|
$currentUserId = (int) ($session['user']['id'] ?? 0);
|
||
|
|
$authorizationService = app(\MintyPHP\Service\Access\AuthorizationService::class);
|
||
|
|
$viewDecision = $authorizationService->authorize(SettingsAuthorizationPolicy::ABILITY_ADMIN_SETTINGS_VIEW, [
|
||
|
|
'actor_user_id' => $currentUserId,
|
||
|
|
]);
|
||
|
|
if (!$viewDecision->isAllowed()) {
|
||
|
|
Guard::deny();
|
||
|
|
}
|
||
|
|
$viewCapabilities = $viewDecision->attribute('capabilities', []);
|
||
|
|
$canUpdateSettings = is_array($viewCapabilities) ? (bool) ($viewCapabilities['can_update_settings'] ?? false) : false;
|
||
|
|
|
||
|
|
Buffer::set('title', t('Branding settings'));
|
||
|
|
|
||
|
|
$breadcrumbs = [
|
||
|
|
['label' => t('Home'), 'path' => 'admin'],
|
||
|
|
['label' => t('Settings'), 'path' => 'admin/settings'],
|
||
|
|
['label' => t('Branding')],
|
||
|
|
];
|