Commit 5d7e0bc5 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Un peu plus générique!

parent 1bfbd62f
......@@ -3,6 +3,8 @@ namespace UnicaenAuth\Provider\Identity;
use UnicaenAuth\Entity\Ldap\People;
use BjyAuthorize\Provider\Identity\AuthenticationIdentityProvider;
use BjyAuthorize\Provider\Role\ProviderInterface;
use ZfcUser\Entity\UserInterface;
/**
* Classe de fournisseur d'identité issue de l'annuaire Ldap.
......@@ -37,13 +39,19 @@ class Ldap extends AuthenticationIdentityProvider implements ChainableProvider//
$identity = $identity['ldap'];
}
if ($identity instanceof People) {
$roles = $identity->getRoles();
$roles[] = $identity->getUsername();
if ($identity instanceof ProviderInterface) {
$roles = $identity->getRoles();
if ($roles instanceof Traversable) {
$roles = iterator_to_array($roles);
}
}
else {
$roles = array();
}
if ($identity instanceof UserInterface) {
$roles[] = $identity->getUsername();
}
if (!$roles) {
$roles = array($this->authenticatedRole);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment