Commit acae0900 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Correction bug lors de la suppression de rôles

parent fc30ab9a
Loading
Loading
Loading
Loading
+1
Changes for CHANGELOG.md: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ author: Laurent Lécluse - DSI - Unicaen
* Un bug modifiant les paramètres globaux qui avaient été configurés a été résolu
* La duplication de statuts refonctionne
* Lors de la création d'un nouveau statut, l'octroi de privilèges ne plante plus
* La suppression de rôle fonctionne de nouveau correctement 


# OSE 9.0.1-zf2 et 9.0.1-zf3
+3
Changes for module/Application/src/Application/Controller/DroitsController.php: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -106,6 +106,9 @@ class DroitsController extends AbstractController
        $title  = "Suppression du rôle";
        $form   = $this->makeFormSupprimer( function() use ($role){
            $this->getServiceRole()->delete($role);
            $this->getCacheFilesystem()->delete(RoleProvider::class.'/affectations');
            $cc = $this->getCacheContainer(PrivilegeService::class);
            unset($cc->privilegesRoles);
        } );

        return compact('role', 'title', 'form');
+8 −1
Changes for module/Application/src/Application/Provider/Identity/IdentityProvider.php: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -60,12 +60,19 @@ class IdentityProvider implements ChainableProvider, IdentityProviderInterface
            if ($utilisateur = $this->getServiceContext()->getUtilisateur()) {
                foreach ($utilisateur->getAffectation() as $affectation) {
                    /* @var $affectation Affectation */
                    $roleId = $affectation->getRole()->getCode();
                    $role = $affectation->getRole();
                    try {
                        $roleId = $role->getCode();
                        if ($role->estNonHistorise()) {
                            if ($structure = $affectation->getStructure()) {
                                $roleId .= '-' . $structure->getSourceCode();
                            }
                            $this->identityRoles[] = $roleId;
                        }
                    }catch(\Exception $e){
                        // on ignore les affectations dont les rôles ont été supprimés
                    }
                }
            }

            /**
+1 −1
Changes for module/Application/src/Application/Provider/Role/RoleProvider.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface
                /* @var $affectation Affectation */
                if ($structure = $affectation->getStructure()) {
                    $affRoleId = $roleId . '-' . $structure->getSourceCode();
                    if (!isset($roles[$affRoleId])) {
                    if (!isset($roles[$affRoleId]) && $dbRole->estNonHistorise()) {
                        $affRoleLibelle = $dbRole->getLibelle() . ' (' . $structure->getLibelleCourt() . ')';
                        $affRole        = new \Application\Acl\Role($affRoleId, $roleId, $affRoleLibelle);
                        if (isset($rolesPrivileges[$roleId])) {