/**
  * get full remote link 
  * Including ecs generated hash and auth mode
  *
  * @return string
  * @throws ilECSConnectorException
  */
 public function getFullRemoteLink()
 {
     global $ilUser;
     include_once './Services/WebServices/ECS/classes/class.ilECSUser.php';
     $user = new ilECSUser($ilUser);
     $ecs_user_data = $user->toGET();
     $GLOBALS['ilLog']->write(__METHOD__ . ': Using ecs user data ' . $ecs_user_data);
     include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
     $server_id = ilECSImport::lookupServerId($this->getId());
     $server = ilECSSetting::getInstanceByServerId($server_id);
     $auth_hash = $this->createAuthResource($this->getRemoteLink() . $user->toREALM());
     $ecs_url_hash = 'ecs_hash_url=' . urlencode($server->getServerURI() . '/sys/auths/' . $auth_hash);
     if (strpos($this->getRemoteLink(), '?')) {
         $link = $this->getRemoteLink() . '&ecs_hash=' . $auth_hash . $ecs_user_data . '&' . $ecs_url_hash;
     } else {
         $link = $this->getRemoteLink() . '?ecs_hash=' . $auth_hash . $ecs_user_data . '&' . $ecs_url_hash;
     }
     $GLOBALS['ilLog']->write(__METHOD__ . ': ECS full link: ' . $link);
     return $link;
 }
 /**
  * update existing user
  *
  * @access protected
  */
 protected function updateUser(ilECSUser $user, $a_local_user_id)
 {
     global $ilClientIniFile, $ilLog, $rbacadmin;
     $user_obj = new ilObjUser($a_local_user_id);
     $user_obj->setFirstname($user->getFirstname());
     $user_obj->setLastname($user->getLastname());
     $user_obj->setEmail($user->getEmail());
     $user_obj->setInstitution($user->getInstitution());
     $user_obj->setActive(true);
     $until = $user_obj->getTimeLimitUntil();
     $user_obj->setTimeLimitFrom(time() - 5);
     if ($until < time() + $ilClientIniFile->readVariable('session', 'expire')) {
         $user_obj->setTimeLimitUntil(time() + $ilClientIniFile->readVariable("session", "expire"));
     }
     $user_obj->update();
     $user_obj->refreshLogin();
     if ($global_role = $this->getCurrentServer()->getGlobalRole()) {
         $rbacadmin->assignUser($this->getCurrentServer()->getGlobalRole(), $user_obj->getId(), true);
     }
     $ilLog->write(__METHOD__ . ': Finished update of remote user with usr_id: ' . $user->getImportId());
     return $user_obj->getLogin();
 }