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

correction pour l'uid

parent 1003c8db
Loading
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -250,11 +250,11 @@ trait HistoriqueAwareTrait
    public function estNonHistorise(DateTime $dateObs = null)
    {
        if (empty($dateObs)) {
            try {
//            try {
                $dateObs = new DateTime();
            } catch (\Exception $e) {
                throw new RuntimeException("Impossible d'instancier un DateTime!", null, $e);
            }
//            } catch (\Exception $e) {
//                throw new RuntimeException("Impossible d'instancier un DateTime!", null, $e);
//            }
        }

        $dObs = $dateObs->format('Y-m-d');
+6 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ class Username implements ProviderInterface
     */
    protected $roles;

    protected $usernamefield;
    /**
     *
     * @param AuthenticationService $authService
@@ -44,6 +45,10 @@ class Username implements ProviderInterface
        $this->config      = $config;
    }

    public function setUsernamefield($usernamefield)
    {
        $this->usernamefield = $usernamefield;
    }
    /**
     * @return \Laminas\Permissions\Acl\Role\RoleInterface[]
     */
@@ -65,7 +70,7 @@ class Username implements ProviderInterface
                    $identity = $identity['db'];
                }
                if ($identity instanceof UserInterface) {
                    $role = new NamedRole($identity->getUsername(), 'user', "Authentifié(e)", null, false);
                    $role = new NamedRole($identity->getUsername($this->usernamefield), 'user', "Authentifié(e)", null, false);
                    $this->roles[] = $role;
                }
            }
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ class UsernameServiceFactory implements FactoryInterface
        $authService = $container->get('zfcuser_auth_service'); /* @var $authService \Laminas\Authentication\AuthenticationService */
//        $authService = $container->get('Laminas\Authentication\AuthenticationService'); /* @var $authService \Laminas\Authentication\AuthenticationService */

        $usernamefield = $config['unicaen-auth']['local']['ldap']['username'];
        return new Username($authService, $providerConfig);
    }
}
 No newline at end of file