예제 #1
0
 /**
  * Do all the synchronization between an ldap result and a Tuleap user.
  *
  * This method returns if it modified the user or not. This is usefull during
  * batch process in order to limit computing.
  *
  * @param User       $user User
  * @param LDAPResult $lr   Ldap result
  *
  * @return Boolean True if the method modified the user object
  */
 public function sync(User $user, LDAPResult $lr)
 {
     $modified = false;
     $ldapEmail = $lr->getEmail();
     $realname = ucwords(preg_replace('/^(\\w+).(\\w+)@.*/', '\\1 \\2', $ldapEmail));
     if ($realname !== null && $user->getRealName() != substr($realname, 0, 32)) {
         $user->setRealName($realname);
         $modified = true;
     }
     if ($ldapEmail !== null && $user->getEmail() != $ldapEmail) {
         $user->setEmail($ldapEmail);
         $modified = true;
     }
     return $modified;
 }
예제 #2
0
 public function getCommonName(LDAPResult $lr)
 {
     return $lr->getCommonName();
 }
예제 #3
0
 public function testMessage(LDAPResult $compare)
 {
     return "Expected {$this->expected}, recieved: {$compare->getCommonName()}";
 }
예제 #4
0
 /**
  * Create user account based on LDAPResult info.
  *
  * @param  LDAPResult $lr
  * @return PFUser
  */
 function createAccountFromLdap(LDAPResult $lr)
 {
     $user = $this->createAccount($lr->getEdUid(), $lr->getLogin(), $lr->getCommonName(), $lr->getEmail());
     return $user;
 }
예제 #5
0
 /**
  * Do all the synchronization between an ldap result and a Codendi user.
  *
  * This method returns if it modified the user or not. This is usefull during
  * batch process in order to limit computing.
  *
  * @param User       $user Codendi user
  * @param LDAPResult $lr   Ldap result
  *
  * @return Boolean True if the method modified the user object
  */
 public function sync(User $user, LDAPResult $lr)
 {
     $modified = false;
     if ($lr->getCommonName() !== null && $user->getRealName() != substr($lr->getCommonName(), 0, 32)) {
         $user->setRealName($lr->getCommonName());
         $modified = true;
     }
     if ($lr->getEmail() !== null && $user->getEmail() != $lr->getEmail()) {
         $user->setEmail($lr->getEmail());
         $modified = true;
     }
     return $modified;
 }
예제 #6
0
 /**
  * @return String
  */
 public function getUid()
 {
     return strtolower($this->ldap_result->getLogin());
 }