Commit accb275b authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

FIX

parent ca3b6401
Loading
Loading
Loading
Loading
−363

File deleted.

+11 −2
Changes for module/Application/config/merged/agent.config.php: 11 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -94,6 +94,17 @@ return [
                        AgentPrivileges::AGENT_INDEX,
                    ],
                ],
                [
                    'controller' => AgentController::class,
                    'action' => [
                        'afficher',
                    ],
                    'privileges' => [
                        AgentPrivileges::AGENT_AFFICHER,
                    ],
//                    'assertion'  => AgentAssertion::class,

                ],
                [
                    'controller' => AgentController::class,
                    'action' => [
@@ -102,8 +113,6 @@ return [
                        'rechercher-with-structure-mere',
                        'rechercher-responsable',
                        'rechercher-gestionnaire',

                        'afficher',
                    ],
                    'privileges' => [
                        AgentPrivileges::AGENT_AFFICHER,
+6 −5
Changes for module/Application/src/Application/Assertion/AgentAffichageAssertion.php: 6 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@ use Application\Provider\Privilege\AgentaffichagePrivileges;
use Application\Provider\Role\RoleProvider as AppRoleProvider;
use Application\Service\Agent\AgentServiceAwareTrait;
use Application\Service\AgentAffectation\AgentAffectationServiceAwareTrait;
use Application\Service\AgentAutorite\AgentAutoriteServiceAwareTrait;
use Application\Service\AgentSuperieur\AgentSuperieurServiceAwareTrait;
use Structure\Provider\Role\RoleProvider as StructureRoleProvider;
use Structure\Service\Structure\StructureServiceAwareTrait;
use UnicaenPrivilege\Assertion\AbstractAssertion;
@@ -18,6 +20,8 @@ use Laminas\Permissions\Acl\Resource\ResourceInterface;
class AgentAffichageAssertion extends AbstractAssertion
{
    use AgentServiceAwareTrait;
    use AgentAutoriteServiceAwareTrait;
    use AgentSuperieurServiceAwareTrait;
    use AgentAffectationServiceAwareTrait;
    use StructureServiceAwareTrait;
    use UserServiceAwareTrait;
@@ -42,13 +46,11 @@ class AgentAffichageAssertion extends AbstractAssertion
        }

        $isResponsable = false;
        $isGestionnaire = false;
        $isSuperieur = false;
        $isAutorite = false;
        if ($role->getRoleId() === StructureRoleProvider::RESPONSABLE) $isResponsable = $this->getStructureService()->isResponsableS($structures, $agent);
        if ($role->getRoleId() === StructureRoleProvider::GESTIONNAIRE) $isGestionnaire = $this->getStructureService()->isGestionnaireS($structures, $agent);
        if ($role->getRoleId() === Agent::ROLE_SUPERIEURE) $isSuperieur = $entity->hasSuperieurHierarchique($agent);
        if ($role->getRoleId() === Agent::ROLE_AUTORITE) $isAutorite = $entity->hasAutoriteHierarchique($agent);
        if ($role->getRoleId() === Agent::ROLE_SUPERIEURE) $isSuperieur = $this->getAgentSuperieurService()->isSuperieur($entity,$agent);
        if ($role->getRoleId() === Agent::ROLE_AUTORITE) $isAutorite = $this->getAgentAutoriteService()->isAutorite($entity,$agent);

        switch ($privilege) {
            case AgentaffichagePrivileges::AGENTAFFICHAGE_COMPTE :
@@ -66,7 +68,6 @@ class AgentAffichageAssertion extends AbstractAssertion
                    case StructureRoleProvider::RESPONSABLE:
                        return $isResponsable;
                    case StructureRoleProvider::GESTIONNAIRE:
                        return $isGestionnaire;
                    case Agent::ROLE_SUPERIEURE:
                        return $isSuperieur;
                    case Agent::ROLE_AUTORITE:
+8
Changes for module/Application/src/Application/Assertion/AgentAffichageAssertionFactory.php: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@ namespace Application\Assertion;

use Application\Service\Agent\AgentService;
use Application\Service\AgentAffectation\AgentAffectationService;
use Application\Service\AgentAutorite\AgentAutoriteService;
use Application\Service\AgentSuperieur\AgentSuperieurService;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
@@ -23,11 +25,15 @@ class AgentAffichageAssertionFactory {
    {
        /**
         * @var AgentService $agentService
         * @var AgentAutoriteService $agentAutoriteService
         * @var AgentSuperieurService $agentSuperieurService
         * @var AgentAffectationService $agentAffectationService
         * @var StructureService $structureService
         * @var UserService $userService
         */
        $agentService = $container->get(AgentService::class);
        $agentAutoriteService = $container->get(AgentAutoriteService::class);
        $agentSuperieurService = $container->get(AgentSuperieurService::class);
        $agentAffectationService = $container->get(AgentAffectationService::class);
        $structureService = $container->get(StructureService::class);
        $userService = $container->get(UserService::class);
@@ -35,6 +41,8 @@ class AgentAffichageAssertionFactory {
        /** @var AgentAssertion $assertion */
        $assertion = new AgentAssertion();
        $assertion->setAgentService($agentService);
        $assertion->setAgentAutoriteService($agentAutoriteService);
        $assertion->setAgentSuperieurService($agentSuperieurService);
        $assertion->setAgentAffectationService($agentAffectationService);
        $assertion->setStructureService($structureService);
        $assertion->setUserService($userService);
+3
Changes for module/Application/view/application/index/partial/agents.phtml: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

use Application\Entity\Db\Agent;
use Application\Provider\Privilege\AgentPrivileges;

/**
 * @var Agent[] $agents
@@ -46,10 +47,12 @@ Voue êtes responsable de <?php echo count($agents); ?> agent·es.
                <?php endforeach; ?>
            </td>
            <td class="action">
                <?php if ($this->isAllowed($agent, AgentPrivileges::AGENT_AFFICHER)) : ?>
                <a href="<?php echo $this->url('agent/afficher', ['agent' => $agent->getId()], [], true); ?>">
                    <span class="icon icon-user"></span>
                    Afficher
                </a>
                <?php endif; ?>
            </td>
        </tr>
    <?php endforeach; ?>