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

Correction d'une notice qui aparaissait si on n'tait pas connecté: pas de selectable role

parent 40bb0af6
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -335,12 +335,15 @@ class UserContext extends AbstractService implements EventManagerAwareInterface
            unset($this->getSessionContainer()->selectedIdentityRole);
        }

        $role = $this->getSelectableIdentityRoles()[$role];
        $selectableIdentityRoles = $this->getSelectableIdentityRoles();
        if (isset($selectableIdentityRoles[$role])){
            $role = $selectableIdentityRoles[$role];
            if ($role instanceof AbstractRole) {
                $this->saveUserLastRole($role);
            }

            $this->triggerUserRoleSelectedEvent(UserRoleSelectedEvent::POST_SELECTION, $role);
        }

        return $this;
    }