Loading module/Application/src/Application/Assertion/DoctorantAssertion.php 0 → 100644 +74 −0 Changes for module/Application/src/Application/Assertion/DoctorantAssertion.php: 74 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Application\Assertion\These; use Application\Assertion\BaseAssertion; use Application\Entity\Db\Role; use Application\Entity\Db\These; use Application\Provider\Privilege\DoctorantPrivileges; use Application\Service\UserContextService; use Zend\Permissions\Acl\Resource\ResourceInterface; /** * Class TheseAssertion * * @package Application\Assertion * @method UserContextService getServiceUserContext() */ class DoctorantAsserction extends BaseAssertion { protected function assertEntity(ResourceInterface $these, $privilege = null) { if (!parent::assertEntity($these, $privilege)) { return false; } /** @var These $these */ $role = $this->userContextService->getSelectedIdentityRole(); $individu = $this->userContextService->getIdentityIndividu(); switch ($privilege) { case $privilege === DoctorantPrivileges::DOCTORANT_AFFICHER_EMAIL_CONTACT : // doctorant if ($role->getCode() === Role::CODE_ADMIN_TECH) return true; if ($role->getCode() === Role::CODE_DOCTORANT) return $these->getDoctorant()->getIndividu() === $individu; return false; break; } return true; } /** * @return static */ protected function initControllerAssertion() { $this->controllerAssertion->setContext([ 'these' => $this->getRouteMatch()->getThese(), 'doctorant' => $this->getRouteMatch()->getDoctorant(), ]); return $this; } /** * @return static */ protected function initPageAssertion() { $this->pageAssertion->setContext(['these' => $this->getRouteMatch()->getThese()]); return $this; } /** * @param ResourceInterface $entity * @return static */ protected function initEntityAssertion(ResourceInterface $entity) { $this->entityAssertion->setContext(['these' => $entity]); return $this; } } No newline at end of file module/Information/config/module.config.php +6 −0 Changes for module/Information/config/module.config.php: 6 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -262,6 +262,12 @@ return [ 'params' => ['id' => 82], 'title' => "Informations sur le déroulement de la thèse et formulaires administratifs à l’intention du doctorant et de ses encadrants" ], 'guide-utilisation' => [ 'label' => 'Guide d\'utilisation', 'route' => 'informations/afficher', 'params' => ['id' => 162], 'title' => "Guide d'utilisation de l'application SyGAL", ], ], ], ], Loading Loading
module/Application/src/Application/Assertion/DoctorantAssertion.php 0 → 100644 +74 −0 Changes for module/Application/src/Application/Assertion/DoctorantAssertion.php: 74 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Application\Assertion\These; use Application\Assertion\BaseAssertion; use Application\Entity\Db\Role; use Application\Entity\Db\These; use Application\Provider\Privilege\DoctorantPrivileges; use Application\Service\UserContextService; use Zend\Permissions\Acl\Resource\ResourceInterface; /** * Class TheseAssertion * * @package Application\Assertion * @method UserContextService getServiceUserContext() */ class DoctorantAsserction extends BaseAssertion { protected function assertEntity(ResourceInterface $these, $privilege = null) { if (!parent::assertEntity($these, $privilege)) { return false; } /** @var These $these */ $role = $this->userContextService->getSelectedIdentityRole(); $individu = $this->userContextService->getIdentityIndividu(); switch ($privilege) { case $privilege === DoctorantPrivileges::DOCTORANT_AFFICHER_EMAIL_CONTACT : // doctorant if ($role->getCode() === Role::CODE_ADMIN_TECH) return true; if ($role->getCode() === Role::CODE_DOCTORANT) return $these->getDoctorant()->getIndividu() === $individu; return false; break; } return true; } /** * @return static */ protected function initControllerAssertion() { $this->controllerAssertion->setContext([ 'these' => $this->getRouteMatch()->getThese(), 'doctorant' => $this->getRouteMatch()->getDoctorant(), ]); return $this; } /** * @return static */ protected function initPageAssertion() { $this->pageAssertion->setContext(['these' => $this->getRouteMatch()->getThese()]); return $this; } /** * @param ResourceInterface $entity * @return static */ protected function initEntityAssertion(ResourceInterface $entity) { $this->entityAssertion->setContext(['these' => $entity]); return $this; } } No newline at end of file
module/Information/config/module.config.php +6 −0 Changes for module/Information/config/module.config.php: 6 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -262,6 +262,12 @@ return [ 'params' => ['id' => 82], 'title' => "Informations sur le déroulement de la thèse et formulaires administratifs à l’intention du doctorant et de ses encadrants" ], 'guide-utilisation' => [ 'label' => 'Guide d\'utilisation', 'route' => 'informations/afficher', 'params' => ['id' => 162], 'title' => "Guide d'utilisation de l'application SyGAL", ], ], ], ], Loading