Skip to content
Snippets Groups Projects
Commit acae0900 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Correction bug lors de la suppression de rôles

parent fc30ab9a
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ author: Laurent Lécluse - DSI - Unicaen ...@@ -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 * Un bug modifiant les paramètres globaux qui avaient été configurés a été résolu
* La duplication de statuts refonctionne * La duplication de statuts refonctionne
* Lors de la création d'un nouveau statut, l'octroi de privilèges ne plante plus * 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 # OSE 9.0.1-zf2 et 9.0.1-zf3
......
...@@ -106,6 +106,9 @@ class DroitsController extends AbstractController ...@@ -106,6 +106,9 @@ class DroitsController extends AbstractController
$title = "Suppression du rôle"; $title = "Suppression du rôle";
$form = $this->makeFormSupprimer( function() use ($role){ $form = $this->makeFormSupprimer( function() use ($role){
$this->getServiceRole()->delete($role); $this->getServiceRole()->delete($role);
$this->getCacheFilesystem()->delete(RoleProvider::class.'/affectations');
$cc = $this->getCacheContainer(PrivilegeService::class);
unset($cc->privilegesRoles);
} ); } );
return compact('role', 'title', 'form'); return compact('role', 'title', 'form');
......
...@@ -60,12 +60,19 @@ class IdentityProvider implements ChainableProvider, IdentityProviderInterface ...@@ -60,12 +60,19 @@ class IdentityProvider implements ChainableProvider, IdentityProviderInterface
if ($utilisateur = $this->getServiceContext()->getUtilisateur()) { if ($utilisateur = $this->getServiceContext()->getUtilisateur()) {
foreach ($utilisateur->getAffectation() as $affectation) { foreach ($utilisateur->getAffectation() as $affectation) {
/* @var $affectation Affectation */ /* @var $affectation Affectation */
$roleId = $affectation->getRole()->getCode(); $role = $affectation->getRole();
try {
$roleId = $role->getCode();
if ($role->estNonHistorise()) {
if ($structure = $affectation->getStructure()) { if ($structure = $affectation->getStructure()) {
$roleId .= '-' . $structure->getSourceCode(); $roleId .= '-' . $structure->getSourceCode();
} }
$this->identityRoles[] = $roleId; $this->identityRoles[] = $roleId;
} }
}catch(\Exception $e){
// on ignore les affectations dont les rôles ont été supprimés
}
}
} }
/** /**
......
...@@ -155,7 +155,7 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface ...@@ -155,7 +155,7 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface
/* @var $affectation Affectation */ /* @var $affectation Affectation */
if ($structure = $affectation->getStructure()) { if ($structure = $affectation->getStructure()) {
$affRoleId = $roleId . '-' . $structure->getSourceCode(); $affRoleId = $roleId . '-' . $structure->getSourceCode();
if (!isset($roles[$affRoleId])) { if (!isset($roles[$affRoleId]) && $dbRole->estNonHistorise()) {
$affRoleLibelle = $dbRole->getLibelle() . ' (' . $structure->getLibelleCourt() . ')'; $affRoleLibelle = $dbRole->getLibelle() . ' (' . $structure->getLibelleCourt() . ')';
$affRole = new \Application\Acl\Role($affRoleId, $roleId, $affRoleLibelle); $affRole = new \Application\Acl\Role($affRoleId, $roleId, $affRoleLibelle);
if (isset($rolesPrivileges[$roleId])) { if (isset($rolesPrivileges[$roleId])) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment