Skip to content
Snippets Groups Projects
Commit 104946df authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

correction pour l'uid

parent 1003c8db
No related branches found
No related tags found
No related merge requests found
Pipeline #18657 passed
......@@ -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');
......
......@@ -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;
}
}
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment