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"));
270 #$now = new ilDateTime(time(), IL_CAL_UNIX);
271 #$userObj->setAgreeDate($now->get(IL_CAL_DATETIME));
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);
293 return $userObj->getLogin();
303 global $ilClientIniFile,
$ilLog,$rbacadmin;
305 $user_obj =
new ilObjUser($a_local_user_id);
308 $user_obj->setEmail($user->
getEmail());
310 $user_obj->setActive(
true);
312 $until = $user_obj->getTimeLimitUntil();
314 if($until < (time() + $ilClientIniFile->readVariable(
'session',
'expire')))
316 $user_obj->setTimeLimitFrom(time() - 60);
317 $user_obj->setTimeLimitUntil(time() + $ilClientIniFile->readVariable(
"session",
"expire"));
320 $user_obj->refreshLogin();
324 $rbacadmin->assignUser(
333 $ilLog->write(__METHOD__.
': Finished update of remote user with usr_id: '.$user->
getImportId());
334 return $user_obj->getLogin();
343 include_once
'./Services/Mail/classes/class.ilMailOptions.php';
362 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
380 include_once(
'./Services/Language/classes/class.ilLanguageFactory.php');
381 include_once
'./Services/Language/classes/class.ilLanguage.php';
385 $lang->loadLanguageModule(
'ecs');
387 include_once(
'./Services/Mail/classes/class.ilMail.php');
389 $mail->enableSoap(
false);
390 $subject =
$lang->txt(
'ecs_new_user_subject');
393 $body =
$lang->txt(
'ecs_new_user_body').
"\n\n";
394 $body .=
$lang->txt(
'ecs_new_user_profile').
"\n\n";
395 $body .= $user_obj->getProfileAsString(
$lang).
"\n\n";