Commit 2b7d8563 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Abandon du test basé sur le type UnicaenAuth\Entity\Db\User pour utiliser...

Abandon du test basé sur le type UnicaenAuth\Entity\Db\User pour utiliser plutôt les interfaces (plus génériques).
parent 441c769f
......@@ -2,7 +2,8 @@
namespace UnicaenAuth\Provider\Identity;
use BjyAuthorize\Provider\Identity\AuthenticationIdentityProvider;
use UnicaenAuth\Entity\Db\User;
use BjyAuthorize\Provider\Role\ProviderInterface;
use ZfcUser\Entity\UserInterface;
/**
* Classe de fournisseur d'identité issue de la base de données des utilisateurs.
......@@ -37,13 +38,16 @@ class Db extends AuthenticationIdentityProvider implements ChainableProvider
$identity = $identity['db'];
}
if ($identity instanceof User) {
$roles = $identity->getRoles();
$roles[] = $identity->getUsername();
if ($identity instanceof ProviderInterface) {
$roles = $identity->getRoles();
}
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