Commit bb1e9370 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

modificaiton uid

parent 232e7639
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -63,8 +63,10 @@ class People extends BasePeople implements UserInterface, ProviderInterface
    /**
     * {@inheritDoc}
     */
    public function getUsername()
    public function getUsername(?string $attribut = "supannAliasLogin")
    {
        if ($attribut === 'supannAliasLogin') return $this->supannaliaslogin;
        if ($attribut === 'uid') return $this->uid;
        return $this->supannaliaslogin;
    }

+7 −1
Original line number Diff line number Diff line
@@ -18,6 +18,12 @@ use ZfcUser\Entity\UserInterface;
 */
class Ldap extends AuthenticationIdentityProvider implements ChainableProvider
{
    protected $usernamefield;

    public function setUsernamefield(?string $value = null)
    {
        $this->usernamefield=$value;
    }
    /**
     * {@inheritDoc}
     */
@@ -50,7 +56,7 @@ class Ldap extends AuthenticationIdentityProvider implements ChainableProvider
        }

        if ($identity instanceof UserInterface) {
            $roles[] = $identity->getUsername();
            $roles[] = $identity->getUsername($this->usernamefield);
        }

        return $roles;
+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ class LdapServiceFactory implements FactoryInterface

        $simpleIdentityProvider->setDefaultRole($config['default_role']);
        $simpleIdentityProvider->setAuthenticatedRole($config['authenticated_role']);
        $usernamefield = $config['unicaen-auth']['local']['ldap']['username'];
        $simpleIdentityProvider->setUsernamefield($usernamefield);

        return $simpleIdentityProvider;
    }
+7 −1
Original line number Diff line number Diff line
@@ -44,6 +44,12 @@ class UserContext extends AbstractService implements EventManagerAwareInterface
     */
    protected $identityRoles;

    private $usernamefield;

    public function setUsernamefield(?string $value = null)
    {
        $this->usernamefield = $value;
    }
    /**
     * @var AuthenticationService
     */
@@ -132,7 +138,7 @@ class UserContext extends AbstractService implements EventManagerAwareInterface
            return $user->getUsername();
        }
        if ($user = $this->getLdapUser()) {
            return $user->getUsername();
            return $user->getUsername($this->usenamefield);
        }
        if ($user = $this->getDbUser()) {
            return $user->getUsername();
+2 −1
Original line number Diff line number Diff line
@@ -32,7 +32,8 @@ class UserContextFactory
        // mais c'est impossible pour l'instant car il y a un cycle dans les dépendances entre services qui
        // provoque une boucle infinie.
        //

        $usernamefield = $config['unicaen-auth']['local']['ldap']['username'];
        $service->setUsernamefield($usernamefield);
        return $service;
    }
}
 No newline at end of file