Commit 258638bc authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Possibilité de reconnaître un compte utilisateur local.

parent 79481be8
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -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
@@ -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
+2 −1
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace UnicaenAuth\Entity\Shibboleth;

use UnicaenAuth\Entity\Db\AbstractUser;
use ZfcUser\Entity\UserInterface;

class ShibUser implements UserInterface
@@ -200,7 +201,7 @@ class ShibUser implements UserInterface
     */
    public function getPassword()
    {
        return 'shib';
        return AbstractUser::PASSWORD_SHIB;
    }

    /**