Ejemplo n.º 1
0
 /**
  * Adding new LDAP User to database
  * @param $userArray
  * @return User
  */
 protected function processDBUserRegister($userArray)
 {
     // Creating DB User object
     $dbUser = new User();
     $dbUser->setUsername($userArray['uid']);
     // Setting empty password
     $dbUser->setPassword('');
     $dbUser->setEmail($userArray['mail']);
     $dbUser->setDn($userArray['userDn']);
     $dbUser->setLastName($userArray['sn']);
     $dbUser->setFirstName($userArray['givenName']);
     $dbUser->setLanguage($userArray['preferredLanguage']);
     $dbUser->setEnabled(true);
     $dbUser->setRoles(['ROLE_USER']);
     // Adding it to database
     $this->em->persist($dbUser);
     $this->em->flush();
     return $dbUser;
 }