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

Correction droit de dl des fiche de poste pdf

parent 2bdfcf10
Loading
Loading
Loading
Loading
+1
Changes for module/Application/config/merged/agent.config.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ return [
                'allow' => [
                    [
                        'privileges' => [
                            AgentPrivileges::AGENT_AFFICHER,
                            AgentPrivileges::AGENT_ELEMENT_VOIR,
                            AgentPrivileges::AGENT_ELEMENT_AJOUTER,
                            AgentPrivileges::AGENT_ELEMENT_MODIFIER,
+19 −1
Changes for module/Application/src/Application/Assertion/AgentAssertion.php: 19 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -39,9 +39,27 @@ class AgentAssertion extends AbstractAssertion {
        if ($role->getRoleId() === RoleProvider::RESPONSABLE)  $isResponsable = $this->getStructureService()->isResponsableS($structures, $agent);
        if ($role->getRoleId() === RoleProvider::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->hasSuperieurHierarchique($agent);
        if ($role->getRoleId() === Agent::ROLE_AUTORITE)       $isAutorite = $entity->hasAutoriteHierarchique($agent);

        switch($privilege) {
            case AgentPrivileges::AGENT_AFFICHER :
                switch ($role->getRoleId()) {
                    case RoleConstant::ADMIN_FONC:
                    case RoleConstant::ADMIN_TECH:
                    case RoleConstant::OBSERVATEUR:
                        return true;
                    case RoleProvider::RESPONSABLE:
                        return $isResponsable;
                    case RoleProvider::GESTIONNAIRE:
                        return $isGestionnaire;
                    case Agent::ROLE_SUPERIEURE:
                        return $isSuperieur;
                    case Agent::ROLE_AUTORITE:
                        return $isAutorite;
                    case Agent::ROLE_AGENT :
                        return $entity === $agent;
                }
                return false;
            case AgentPrivileges::AGENT_ACQUIS_AFFICHER:
                case true;
            case AgentPrivileges::AGENT_ACQUIS_MODIFIER: