24 include_once(
'Auth/Container.php');
118 $ilLog->write(__METHOD__.
': Starting ECS authentication.');
122 $GLOBALS[
'ilLog']->write(__METHOD__.
': no active ecs server found. Aborting');
127 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
136 $GLOBALS[
'ilLog']->write(__METHOD__.
': Could not validate ecs hash for any server');
155 if(isset(
$_GET[
'ecs_hash']) and strlen(
$_GET[
'ecs_hash']))
157 $hash =
$_GET[
'ecs_hash'];
159 if(isset(
$_GET[
'ecs_hash_url']))
161 $hashurl = urldecode(
$_GET[
'ecs_hash_url']);
162 $hash = basename(parse_url($hashurl,PHP_URL_PATH));
166 $GLOBALS[
'ilLog']->write(__METHOD__.
': Using ecs hash '. $hash);
171 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnector.php');
173 $res = $connector->getAuth($hash);
174 $auths =
$res->getResult();
175 $this->abreviation = $auths->abbr;
176 $ilLog->write(__METHOD__.
': Got abr: '.$this->abreviation);
181 $ilLog->write(__METHOD__.
': Authentication failed with message: '.$e->getMessage());
193 include_once(
'./Services/WebServices/ECS/classes/class.ilECSUser.php');
207 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
211 $a_auth->setAuth($username);
212 $this->
log->write(__METHOD__.
': Login succesesful');
223 $this->
log->write(__METHOD__.
': Login failed');
240 include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
243 $newUser[
"login"] = $local_user;
246 $newUser[
'email'] = $user->
getEmail();
250 $newUser[
"passwd"] =
"";
253 $newUser[
"auth_mode"] =
"ecs";
254 $newUser[
"profile_incomplete"] = 0;
257 $userObj->assignData($newUser);
258 $userObj->setTitle($userObj->getFullname());
259 $userObj->setDescription($userObj->getEmail());
262 $userObj->setLanguage($ilSetting->get(
"language"));
265 $userObj->setTimeLimitOwner(7);
266 $userObj->setTimeLimitUnlimited(0);
267 $userObj->setTimeLimitFrom(time() - 5);
268 $userObj->setTimeLimitUntil(time() + $ilClientIniFile->readVariable(
"session",
"expire"));
274 $userObj->setOwner(6);
276 $userObj->setActive(1);
277 $userObj->updateOwner();
278 $userObj->saveAsNew();
279 $userObj->writePrefs();
283 $rbacadmin->assignUser($this->
getCurrentServer()->getGlobalRole(), $userObj->getId(),
true);
287 $ilLog->write(__METHOD__ .
': Created new remote user with usr_id: ' . $user->
getImportId());
290 #$this->sendNotification($userObj);
292 return $userObj->getLogin();
302 global $ilClientIniFile,
$ilLog,$rbacadmin;
304 $user_obj =
new ilObjUser($a_local_user_id);
307 $user_obj->setEmail($user->
getEmail());
309 $user_obj->setActive(
true);
311 $until = $user_obj->getTimeLimitUntil();
312 $user_obj->setTimeLimitFrom(time() - 5);
314 if($until < (time() + $ilClientIniFile->readVariable(
'session',
'expire')))
316 $user_obj->setTimeLimitUntil(time() + $ilClientIniFile->readVariable(
"session",
"expire"));
319 $user_obj->refreshLogin();
323 $rbacadmin->assignUser(
330 $ilLog->write(__METHOD__.
': Finished update of remote user with usr_id: '.$user->
getImportId());
331 return $user_obj->getLogin();
343 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
361 include_once(
'./Services/Language/classes/class.ilLanguageFactory.php');
362 include_once
'./Services/Language/classes/class.ilLanguage.php';
366 $lang->loadLanguageModule(
'ecs');
368 include_once(
'./Services/Mail/classes/class.ilMail.php');
370 $mail->enableSoap(
false);
371 $subject =
$lang->txt(
'ecs_new_user_subject');
374 $body =
$lang->txt(
'ecs_new_user_body').
"\n\n";
375 $body .=
$lang->txt(
'ecs_new_user_profile').
"\n\n";
376 $body .= $user_obj->getProfileAsString(
$lang).
"\n\n";