Loading src/UnicaenAuth/Entity/Db/AbstractUser.php +19 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,9 @@ use Doctrine\ORM\Mapping as ORM; */ abstract class AbstractUser implements UserInterface, ProviderInterface { const PASSWORD_LDAP = 'ldap'; const PASSWORD_SHIB = 'shib'; /** * @var int * @ORM\Id Loading Loading @@ -246,6 +249,22 @@ abstract class AbstractUser implements UserInterface, ProviderInterface $this->roles->add($role); } /** * Retourne true si cet utilisateur est local. * * Un utilisateur est local s'il ne résulte pas d'une authentification LDAP ou Shibboleth. * Son mot de passe est chiffré dans la table des utilisateurs. * * @return bool */ public function isLocal() { return ! in_array($this->getPassword(), [ AbstractUser::PASSWORD_LDAP, AbstractUser::PASSWORD_SHIB, ]); } /** * * @return string Loading src/UnicaenAuth/Entity/Shibboleth/ShibUser.php +2 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace UnicaenAuth\Entity\Shibboleth; use UnicaenAuth\Entity\Db\AbstractUser; use ZfcUser\Entity\UserInterface; class ShibUser implements UserInterface Loading Loading @@ -200,7 +201,7 @@ class ShibUser implements UserInterface */ public function getPassword() { return 'shib'; return AbstractUser::PASSWORD_SHIB; } /** Loading Loading
src/UnicaenAuth/Entity/Db/AbstractUser.php +19 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,9 @@ use Doctrine\ORM\Mapping as ORM; */ abstract class AbstractUser implements UserInterface, ProviderInterface { const PASSWORD_LDAP = 'ldap'; const PASSWORD_SHIB = 'shib'; /** * @var int * @ORM\Id Loading Loading @@ -246,6 +249,22 @@ abstract class AbstractUser implements UserInterface, ProviderInterface $this->roles->add($role); } /** * Retourne true si cet utilisateur est local. * * Un utilisateur est local s'il ne résulte pas d'une authentification LDAP ou Shibboleth. * Son mot de passe est chiffré dans la table des utilisateurs. * * @return bool */ public function isLocal() { return ! in_array($this->getPassword(), [ AbstractUser::PASSWORD_LDAP, AbstractUser::PASSWORD_SHIB, ]); } /** * * @return string Loading
src/UnicaenAuth/Entity/Shibboleth/ShibUser.php +2 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace UnicaenAuth\Entity\Shibboleth; use UnicaenAuth\Entity\Db\AbstractUser; use ZfcUser\Entity\UserInterface; class ShibUser implements UserInterface Loading Loading @@ -200,7 +201,7 @@ class ShibUser implements UserInterface */ public function getPassword() { return 'shib'; return AbstractUser::PASSWORD_SHIB; } /** Loading