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');
174 include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
177 $newUser[
"login"] = $local_user;
180 $newUser[
'email'] = $user->
getEmail();
184 $newUser[
"passwd"] =
"";
187 $newUser[
"auth_mode"] =
"ecs";
188 $newUser[
"profile_incomplete"] = 0;
191 $userObj->assignData($newUser);
192 $userObj->setTitle($userObj->getFullname());
193 $userObj->setDescription($userObj->getEmail());
196 $userObj->setLanguage($ilSetting->get(
"language"));
199 $userObj->setTimeLimitOwner(7);
200 $userObj->setTimeLimitUnlimited(0);
201 $userObj->setTimeLimitFrom(time());
202 $userObj->setTimeLimitUntil(time() + $ilClientIniFile->readVariable(
"session",
"expire"));
205 $userObj->setOwner(6);
207 $userObj->setActive(1);
208 $userObj->updateOwner();
209 $userObj->saveAsNew();
210 $userObj->writePrefs();
213 if($global_role = $this->settings->getGlobalRole())
215 $rbacadmin->assignUser($this->settings->getGlobalRole(),$userObj->getId(),
true);
219 $ilLog->write(__METHOD__.
': Created new remote user with usr_id: '.$user->
getImportId());
222 #$this->sendNotification($userObj);
224 return $userObj->getLogin();
234 global $ilClientIniFile,
$ilLog,$rbacadmin;
236 $user_obj =
new ilObjUser($a_local_user_id);
239 $user_obj->setEmail($user->
getEmail());
242 $until = $user_obj->getTimeLimitUntil();
244 if($until < (time() + $ilClientIniFile->readVariable(
'session',
'expire')))
246 $user_obj->setTimeLimitFrom(time());
247 $user_obj->setTimeLimitUntil(time() + $ilClientIniFile->readVariable(
"session",
"expire"));
250 $user_obj->refreshLogin();
253 if($global_role = $this->settings->getGlobalRole())
255 $rbacadmin->assignUser($this->settings->getGlobalRole(),$user_obj->getId(),
true);
258 $ilLog->write(__METHOD__.
': Finished update of remote user with usr_id: '.$user->
getImportId());
259 return $user_obj->getLogin();
271 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettings.php');
284 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettings.php');
297 if(!count($this->settings->getUserRecipients()))
302 include_once(
'./Services/Language/classes/class.ilLanguageFactory.php');
306 $lang->loadLanguageModule(
'ecs');
308 include_once(
'./Services/Mail/classes/class.ilMail.php');
310 $mail->enableSoap(
false);
311 $subject =
$lang->txt(
'ecs_new_user_subject');
314 $body =
$lang->txt(
'ecs_new_user_body').
"\n\n";
315 $body .=
$lang->txt(
'ecs_new_user_profile').
"\n\n";
316 $body .= $user_obj->getProfileAsString(
$lang).
"\n\n";
319 $mail->sendMail($this->settings->getUserRecipientsAsString(),
"",
"",$subject,$body,array(),array(
"normal"));