Loading module/Intervenant/config/module.config.php +1 −1 Changes for module/Intervenant/config/module.config.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ return [ Assertion\NoteAssertion::class => \UnicaenPrivilege\Assertion\AssertionFactory::class, Service\MailService::class => Service\MailServiceFactory::class, Assertion\StatutAssertion::class => Assertion\StatutAssertionFactory::class, Assertion\StatutAssertion::class => \UnicaenPrivilege\Assertion\AssertionFactory::class, ], Loading module/Intervenant/src/Assertion/StatutAssertionFactory.php −x−32 File deleted. Show changes module/OffreFormation/config/module.config.php +7 Changes for module/OffreFormation/config/module.config.php: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -598,6 +598,12 @@ return [ 'resources' => ['ElementPedagogique'], 'assertion' => Assertion\OffreDeFormationAssertion::class, ], [ 'privileges' => Privileges::TYPE_INTERVENTION_EDITION, 'resources' => ['TypeInterventionStructure'], 'assertion' => Assertion\TypeInterventionAssertion::class, ], ], 'controllers' => [ Loading @@ -624,6 +630,7 @@ return [ Service\DomaineFonctionnelService::class => Service\Factory\DomaineFonctionnelServiceFactory::class, Service\OffreFormationService::class => Service\Factory\OffreFormationServiceFactory::class, Assertion\OffreDeFormationAssertion::class => \UnicaenPrivilege\Assertion\AssertionFactory::class, Assertion\TypeInterventionAssertion::class => \UnicaenPrivilege\Assertion\AssertionFactory::class, Service\VolumeHoraireEnsService::class => Service\Factory\VolumeHoraireEnsServiceFactory::class, Processus\ReconductionProcessus::class => Processus\Factory\ReconductionProcessusFactory::class, Service\TypeInterventionService::class => Service\Factory\TypeInterventionServiceFactory::class, Loading module/OffreFormation/src/Assertion/TypeInterventionAssertion.php +x+63 Changes for module/OffreFormation/src/Assertion/TypeInterventionAssertion.php: 63 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace OffreFormation\Assertion; use Application\Acl\Role; use Application\Provider\Privilege\Privileges; use Application\Service\Traits\ContextServiceAwareTrait; use Application\Service\Traits\ParametresServiceAwareTrait; use Laminas\Permissions\Acl\Resource\ResourceInterface; use Lieu\Entity\Db\Structure; use OffreFormation\Entity\Db\TypeInterventionStructure; use UnicaenPrivilege\Assertion\AbstractAssertion; /** * Description of OffreDeFormationAssertion * * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> */ class TypeInterventionAssertion extends AbstractAssertion { use ContextServiceAwareTrait; use ParametresServiceAwareTrait; protected function assertEntity(ResourceInterface $entity = null, $privilege = null) { $role = $this->getRole(); // Si le rôle n'est pas renseigné alors on s'en va... if (!$role instanceof Role) return false; // pareil si le rôle ne possède pas le privilège adéquat if ($privilege && !$role->hasPrivilege($privilege)) return false; // Si c'est bon alors on affine... switch (true) { case $entity instanceof TypeInterventionStructure: switch ($privilege) { case Privileges::TYPE_INTERVENTION_EDITION: return $this->assertTypeInterventionStructureSaisie($role, $entity); } break; } return true; } protected function assertTypeInterventionStructureSaisie(Role $role, TypeInterventionStructure $tis) { return $this->assertStructureSaisie($role, $tis->getStructure()); } protected function assertStructureSaisie(Role $role, Structure $structure) { if ($rs = $role->getStructure()) { return $structure->inStructure($rs); } return true; } } No newline at end of file module/OffreFormation/src/Entity/Db/TypeInterventionStructure.php +9 −1 Changes for module/OffreFormation/src/Entity/Db/TypeInterventionStructure.php: 9 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace OffreFormation\Entity\Db; use Application\Entity\Db\Annee; use Laminas\Permissions\Acl\Resource\ResourceInterface; use OffreFormation\Entity\Db\Traits\TypeInterventionAwareTrait; use Lieu\Entity\Db\StructureAwareTrait; use UnicaenApp\Entity\HistoriqueAwareInterface; Loading @@ -11,7 +12,7 @@ use UnicaenApp\Entity\HistoriqueAwareTrait; /** * TypeInterventionStructure */ class TypeInterventionStructure implements HistoriqueAwareInterface class TypeInterventionStructure implements HistoriqueAwareInterface, ResourceInterface { use HistoriqueAwareTrait; use TypeInterventionAwareTrait; Loading Loading @@ -51,6 +52,13 @@ class TypeInterventionStructure implements HistoriqueAwareInterface public function getResourceId(): string { return 'TypeInterventionStructure'; } /** * @return bool */ Loading Loading
module/Intervenant/config/module.config.php +1 −1 Changes for module/Intervenant/config/module.config.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ return [ Assertion\NoteAssertion::class => \UnicaenPrivilege\Assertion\AssertionFactory::class, Service\MailService::class => Service\MailServiceFactory::class, Assertion\StatutAssertion::class => Assertion\StatutAssertionFactory::class, Assertion\StatutAssertion::class => \UnicaenPrivilege\Assertion\AssertionFactory::class, ], Loading
module/OffreFormation/config/module.config.php +7 Changes for module/OffreFormation/config/module.config.php: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -598,6 +598,12 @@ return [ 'resources' => ['ElementPedagogique'], 'assertion' => Assertion\OffreDeFormationAssertion::class, ], [ 'privileges' => Privileges::TYPE_INTERVENTION_EDITION, 'resources' => ['TypeInterventionStructure'], 'assertion' => Assertion\TypeInterventionAssertion::class, ], ], 'controllers' => [ Loading @@ -624,6 +630,7 @@ return [ Service\DomaineFonctionnelService::class => Service\Factory\DomaineFonctionnelServiceFactory::class, Service\OffreFormationService::class => Service\Factory\OffreFormationServiceFactory::class, Assertion\OffreDeFormationAssertion::class => \UnicaenPrivilege\Assertion\AssertionFactory::class, Assertion\TypeInterventionAssertion::class => \UnicaenPrivilege\Assertion\AssertionFactory::class, Service\VolumeHoraireEnsService::class => Service\Factory\VolumeHoraireEnsServiceFactory::class, Processus\ReconductionProcessus::class => Processus\Factory\ReconductionProcessusFactory::class, Service\TypeInterventionService::class => Service\Factory\TypeInterventionServiceFactory::class, Loading
module/OffreFormation/src/Assertion/TypeInterventionAssertion.php +x+63 Changes for module/OffreFormation/src/Assertion/TypeInterventionAssertion.php: 63 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace OffreFormation\Assertion; use Application\Acl\Role; use Application\Provider\Privilege\Privileges; use Application\Service\Traits\ContextServiceAwareTrait; use Application\Service\Traits\ParametresServiceAwareTrait; use Laminas\Permissions\Acl\Resource\ResourceInterface; use Lieu\Entity\Db\Structure; use OffreFormation\Entity\Db\TypeInterventionStructure; use UnicaenPrivilege\Assertion\AbstractAssertion; /** * Description of OffreDeFormationAssertion * * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> */ class TypeInterventionAssertion extends AbstractAssertion { use ContextServiceAwareTrait; use ParametresServiceAwareTrait; protected function assertEntity(ResourceInterface $entity = null, $privilege = null) { $role = $this->getRole(); // Si le rôle n'est pas renseigné alors on s'en va... if (!$role instanceof Role) return false; // pareil si le rôle ne possède pas le privilège adéquat if ($privilege && !$role->hasPrivilege($privilege)) return false; // Si c'est bon alors on affine... switch (true) { case $entity instanceof TypeInterventionStructure: switch ($privilege) { case Privileges::TYPE_INTERVENTION_EDITION: return $this->assertTypeInterventionStructureSaisie($role, $entity); } break; } return true; } protected function assertTypeInterventionStructureSaisie(Role $role, TypeInterventionStructure $tis) { return $this->assertStructureSaisie($role, $tis->getStructure()); } protected function assertStructureSaisie(Role $role, Structure $structure) { if ($rs = $role->getStructure()) { return $structure->inStructure($rs); } return true; } } No newline at end of file
module/OffreFormation/src/Entity/Db/TypeInterventionStructure.php +9 −1 Changes for module/OffreFormation/src/Entity/Db/TypeInterventionStructure.php: 9 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace OffreFormation\Entity\Db; use Application\Entity\Db\Annee; use Laminas\Permissions\Acl\Resource\ResourceInterface; use OffreFormation\Entity\Db\Traits\TypeInterventionAwareTrait; use Lieu\Entity\Db\StructureAwareTrait; use UnicaenApp\Entity\HistoriqueAwareInterface; Loading @@ -11,7 +12,7 @@ use UnicaenApp\Entity\HistoriqueAwareTrait; /** * TypeInterventionStructure */ class TypeInterventionStructure implements HistoriqueAwareInterface class TypeInterventionStructure implements HistoriqueAwareInterface, ResourceInterface { use HistoriqueAwareTrait; use TypeInterventionAwareTrait; Loading Loading @@ -51,6 +52,13 @@ class TypeInterventionStructure implements HistoriqueAwareInterface public function getResourceId(): string { return 'TypeInterventionStructure'; } /** * @return bool */ Loading