Fixed: [calendar] refactor ACL on calendar

This commit is contained in:
2022-11-28 12:22:58 +01:00
parent a73dca5efe
commit 74673380aa
6 changed files with 130 additions and 36 deletions

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\CalendarBundle\DependencyInjection;
use Chill\CalendarBundle\Security\Voter\CalendarVoter;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
@@ -52,9 +53,10 @@ class ChillCalendarExtension extends Extension implements PrependExtensionInterf
{
$this->preprendRoutes($container);
$this->prependCruds($container);
$this->prependRoleHierarchy($container);
}
protected function prependCruds(ContainerBuilder $container)
private function prependCruds(ContainerBuilder $container)
{
$container->prependExtensionConfig('chill_main', [
'cruds' => [
@@ -130,7 +132,18 @@ class ChillCalendarExtension extends Extension implements PrependExtensionInterf
]);
}
protected function preprendRoutes(ContainerBuilder $container)
private function prependRoleHierarchy(ContainerBuilder $container): void
{
$container->prependExtensionConfig('security', [
'role_hierarchy' => [
CalendarVoter::CREATE => [CalendarVoter::SEE],
CalendarVoter::EDIT => [CalendarVoter::SEE],
CalendarVoter::DELETE => [CalendarVoter::SEE],
],
]);
}
private function preprendRoutes(ContainerBuilder $container)
{
$container->prependExtensionConfig('chill_main', [
'routing' => [