24 include_once(
'Auth/Container.php');
91 $ilLog->write(__METHOD__.
': Starting ECS authentication.');
93 if(!$this->settings->isEnabled())
95 $ilLog->write(__METHOD__.
': ECS settings .');
100 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnector.php');
105 $res = $connector->getAuth(
$_GET[
'ecs_hash']);
106 $auths =
$res->getResult();
107 $this->mid = $auths[0]->mid;
108 $ilLog->write(__METHOD__.
': Got mid: '.$this->mid);
109 $this->abreviation = $auths[0]->abr;
110 $ilLog->write(__METHOD__.
': Got abr: '.$this->abreviation);
121 $ilLog->write(__METHOD__.
': Authentication failed with message: '.$e->getMessage());
133 include_once(
'./Services/WebServices/ECS/classes/class.ilECSUser.php');
146 $a_auth->setAuth($username);
147 $this->
log->write(__METHOD__.
': Login succesesful');
158 $this->
log->write(__METHOD__.
': Login failed');
175 include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
178 $newUser[
"login"] = $local_user;
181 $newUser[
'email'] = $user->
getEmail();
185 $newUser[
"passwd"] =
"";
188 $newUser[
"auth_mode"] =
"ecs";
189 $newUser[
"profile_incomplete"] = 0;
192 $userObj->assignData($newUser);
193 $userObj->setTitle($userObj->getFullname());
194 $userObj->setDescription($userObj->getEmail());
197 $userObj->setLanguage($ilSetting->get(
"language"));
200 $userObj->setTimeLimitOwner(7);
201 $userObj->setTimeLimitUnlimited(0);
202 $userObj->setTimeLimitFrom(time());
203 $userObj->setTimeLimitUntil(time() + $ilClientIniFile->readVariable(
"session",
"expire"));
206 $userObj->setOwner(6);
208 $userObj->setActive(1);
209 $userObj->updateOwner();
210 $userObj->saveAsNew();
211 $userObj->writePrefs();
214 if($global_role = $this->settings->getGlobalRole())
216 $rbacadmin->assignUser($this->settings->getGlobalRole(),$userObj->getId(),
true);
220 $ilLog->write(__METHOD__.
': Created new remote user with usr_id: '.$user->
getImportId());
223 #$this->sendNotification($userObj);
225 return $userObj->getLogin();
235 global $ilClientIniFile,
$ilLog,$rbacadmin;
237 $user_obj =
new ilObjUser($a_local_user_id);
240 $user_obj->setEmail($user->
getEmail());
243 $until = $user_obj->getTimeLimitUntil();
245 if($until < (time() + $ilClientIniFile->readVariable(
'session',
'expire')))
247 $user_obj->setTimeLimitFrom(time());
248 $user_obj->setTimeLimitUntil(time() + $ilClientIniFile->readVariable(
"session",
"expire"));
251 $user_obj->refreshLogin();
254 if($global_role = $this->settings->getGlobalRole())
256 $rbacadmin->assignUser($this->settings->getGlobalRole(),$user_obj->getId(),
true);
259 $ilLog->write(__METHOD__.
': Finished update of remote user with usr_id: '.$user->
getImportId());
260 return $user_obj->getLogin();
272 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettings.php');
285 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettings.php');
298 if(!count($this->settings->getUserRecipients()))
303 include_once(
'./Services/Language/classes/class.ilLanguageFactory.php');
307 $lang->loadLanguageModule(
'ecs');
309 include_once(
'./Services/Mail/classes/class.ilMail.php');
311 $mail->enableSoap(
false);
312 $subject =
$lang->txt(
'ecs_new_user_subject');
315 $body =
$lang->txt(
'ecs_new_user_body').
"\n\n";
316 $body .=
$lang->txt(
'ecs_new_user_profile').
"\n\n";
317 $body .= $user_obj->getProfileAsString(
$lang).
"\n\n";
320 $mail->sendMail($this->settings->getUserRecipientsAsString(),
"",
"",$subject,$body,array(),array(
"normal"));