Added hasRole twig extension and Auditer role & permission set

This commit is contained in:
2023-05-31 14:00:52 +01:00
parent a67214d024
commit fc707b1abf
7 changed files with 465 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ namespace UserFrosting\Sprinkle\UFTweaks\ServicesProvider;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use UserFrosting\Sprinkle\UFTweaks\Twig\HasRoleExtension;
/**
@@ -103,5 +104,18 @@ class ServicesProvider
return $authorizer;
});
/*
* Extends the 'view' service with the HasRole extension for Twig.
*
* @return \Slim\Views\Twig
*/
$container->extend('view', function ($view, $c) {
$twig = $view->getEnvironment();
$twig->addExtension(new HasRoleExtension($c));
return $view;
});
}
}