This commit is contained in:
Julien Fastré 2022-05-02 16:44:26 +02:00
parent ee14cd268b
commit 14341b9768
3 changed files with 15 additions and 18 deletions

View File

@ -19,7 +19,6 @@ use Chill\MainBundle\Templating\Entity\UserRender;
use Chill\PersonBundle\Repository\AccompanyingPeriodACLAwareRepositoryInterface; use Chill\PersonBundle\Repository\AccompanyingPeriodACLAwareRepositoryInterface;
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Exception\TransformationFailedException;
@ -32,9 +31,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\Templating\EngineInterface; use Symfony\Component\Templating\EngineInterface;
use Symfony\Component\Validator\Constraints\NotEqualTo;
use Symfony\Component\Validator\Constraints\NotIdenticalTo; use Symfony\Component\Validator\Constraints\NotIdenticalTo;
use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\NotNull;
use function is_int; use function is_int;

View File

@ -66,13 +66,13 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
} }
if ($this->authorizationChecker->isGranted(AccompanyingPeriodVoter::REASSIGN_BULK, null)) { if ($this->authorizationChecker->isGranted(AccompanyingPeriodVoter::REASSIGN_BULK, null)) {
$menu->addChild($this->translator->trans('reassign.Bulk reassign'), [ $menu->addChild($this->translator->trans('reassign.Bulk reassign'), [
'route' => 'chill_course_list_reassign', 'route' => 'chill_course_list_reassign',
]) ])
->setExtras([ ->setExtras([
'order' => 40, 'order' => 40,
'icons' => [], 'icons' => [],
]); ]);
} }
} }

View File

@ -26,7 +26,7 @@ use function in_array;
class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
{ {
/** /**
* all the roles that are linked to an accompanying period * all the roles that are linked to an accompanying period.
*/ */
public const ALL = [ public const ALL = [
self::SEE, self::SEE,
@ -40,6 +40,11 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
self::RE_OPEN_COURSE, self::RE_OPEN_COURSE,
]; ];
/**
* Give the ability to see all confidential courses.
*/
public const CONFIDENTIAL_CRUD = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CRUD_CONFIDENTIAL';
public const CREATE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CREATE'; public const CREATE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CREATE';
/** /**
@ -70,7 +75,7 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
public const RE_OPEN_COURSE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_REOPEN'; public const RE_OPEN_COURSE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_REOPEN';
/** /**
* Allow user to bulk reassign the courses * Allow user to bulk reassign the courses.
*/ */
public const REASSIGN_BULK = 'CHILL_PERSON_ACCOMPANYING_COURSE_REASSIGN_BULK'; public const REASSIGN_BULK = 'CHILL_PERSON_ACCOMPANYING_COURSE_REASSIGN_BULK';
@ -83,11 +88,6 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
*/ */
public const SEE_DETAILS = 'CHILL_PERSON_ACCOMPANYING_PERIOD_SEE_DETAILS'; public const SEE_DETAILS = 'CHILL_PERSON_ACCOMPANYING_PERIOD_SEE_DETAILS';
/**
* Give the ability to see all confidential courses
*/
public const CONFIDENTIAL_CRUD = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CRUD_CONFIDENTIAL';
public const TOGGLE_CONFIDENTIAL = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_CONFIDENTIAL'; public const TOGGLE_CONFIDENTIAL = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_CONFIDENTIAL';
/** /**
@ -129,7 +129,7 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
self::FULL, self::FULL,
self::TOGGLE_CONFIDENTIAL_ALL, self::TOGGLE_CONFIDENTIAL_ALL,
self::REASSIGN_BULK, self::REASSIGN_BULK,
]; ];
} }
public function getRolesWithHierarchy(): array public function getRolesWithHierarchy(): array