backports murph-skeleton

This commit is contained in:
Simon Vieille 2022-03-11 09:50:24 +01:00
parent c6a7d40a4f
commit ee2f82e93a
5 changed files with 24 additions and 7 deletions

View File

@ -32,6 +32,7 @@ abstract class AdminController extends AbstractController
$parameters['section'] = $this->getSection();
$parameters['site_name'] = $this->coreParameters['site']['name'];
$parameters['site_logo'] = $this->coreParameters['site']['logo'];
$parameters['murph_version'] = defined('MURPH_VERSION') ? MURPH_VERSION : null;
return parent::render($view, $parameters, $response);
}

View File

@ -44,22 +44,20 @@ class RequestSecurityEventSubscriber implements EventSubscriberInterface
}
$operator = $node->getSecurityOperator();
$exception = new AccessDeniedException('Access denied');
$isAuthorized = false;
$exception = new AccessDeniedException('Access denied.');
foreach ($roles as $role) {
$isGranted = $this->authorizationChecker->isGranted($role);
if ('or' === $operator && $isGranted) {
$isAuthorized = true;
} elseif ('and' === $operator && !$isGranted) {
return;
}
if ('and' === $operator && !$isGranted) {
throw $exception;
}
}
if (!$isAuthorized) {
throw $exception;
}
throw $exception;
}
public static function getSubscribedEvents(): array

View File

@ -546,3 +546,13 @@ form {
line-height: normal;
}
}
#murph-version {
display: inline;
font-size: 14px;
margin-left: 2px;
a {
color: #333;
}
}

View File

@ -22,6 +22,12 @@
<div class="ml-auto">
{{ include('@Core/admin/module/account.html.twig') }}
{% if murph_version %}
<div id="murph-version">
<a href="https://doc.murph-project.org/" target="_blank">{{ murph_version }}</a>
</div>
{% endif %}
</div>
</nav>

View File

@ -9,6 +9,8 @@ require dirname(__DIR__).'/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
define('MURPH_VERSION', 'v1.8.0');
if ($_SERVER['APP_DEBUG']) {
umask(0000);