Commit 0f960b36 authored by Mikael Salson's avatar Mikael Salson
Browse files

Lille1UserProvider: remove hostname from login

Depending on the login entered we may have, or not, the @univ-lille.fr at the end
parent 9ea06b6a
......@@ -14,6 +14,10 @@ use Alecsia\AnnotationBundle\Service\EntityServices\StudentService;
use Alecsia\AnnotationBundle\Security\User\YamlAlecsiaUser;
use BeSimple\SsoAuthBundle\Security\Core\User\UserFactoryInterface;
function removeHostname($username) {
return preg_replace("/@.*$/", "", $username);
}
class Lille1UserProvider implements UserProviderInterface, UserFactoryInterface {
/* ================================= */
/* Core methods */
......@@ -21,6 +25,7 @@ class Lille1UserProvider implements UserProviderInterface, UserFactoryInterface
/** @return AlecsiaUser */
public function loadUserByUsername($username) {
$username = removeHostname($username);
$alecsiaTeachers = $this->getTeacherService();
$lille1Teachers = $this->getLille1TeacherBook();
$alecsiaStudents = $this->getStudentService();
......@@ -43,6 +48,7 @@ class Lille1UserProvider implements UserProviderInterface, UserFactoryInterface
}
public function createUser($username, array $roles, array $attributes) {
$username = removeHostname($username);
$student = Student::studentFromMap(array('login' => $username,
'firstName' => $attributes['cas:givenname'],
'lastName' => $attributes['cas:sn'],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment