106 : bool
107 {
108 $this->logger->debug(sprintf(
109 'Login observer called for SOAP authentication request of ext_account "%s" and auth_mode "%s".',
111 'soap'
112 ));
113 $this->logger->debug(sprintf(
114 'Trying to find ext_account "%s" for auth_mode "%s".',
116 'soap'
117 ));
118
120 'soap',
122 );
123
124 $isNewUser = false;
125 if ('' === $internalLogin || false === $internalLogin) {
126 $isNewUser = true;
127 }
128
129 $soapAction = '';
130 $nspref = '';
131 if ($this->use_dot_net) {
132 $soapAction = $this->server_nms . '/isValidSession';
133 $nspref = 'ns1:';
134 }
135
136 $valid = $this->client->call(
137 'isValidSession',
138 [
141 $nspref . 'new_user' => $isNewUser
142 ],
143 $this->server_nms,
144 $soapAction
145 );
146
147 if (
$valid[
'valid'] !==
true) {
149 }
150
152 $status->setReason(
'err_wrong_login');
153 return false;
154 }
155
156 if (!$isNewUser) {
158 return true;
159 } elseif (!$this->
settings->get(
'soap_auth_create_users')) {
160
162 return false;
163 }
164
167
168 $usrData = [];
169 $usrData[
'firstname'] =
$valid[
'firstname'];
170 $usrData[
'lastname'] =
$valid[
'lastname'];
171 $usrData[
'email'] =
$valid[
'email'];
172 $usrData['login'] = $internalLogin;
173 $usrData['passwd'] = '';
175
177 if ($this->
settings->get(
'soap_auth_allow_local')) {
182 }
183
184 $usrData['auth_mode'] = 'soap';
186 $usrData['profile_incomplete'] = 1;
187
188 $userObj->assignData($usrData);
189 $userObj->setTitle($userObj->getFullname());
190 $userObj->setDescription($userObj->getEmail());
191 $userObj->setLanguage($this->
language->getDefaultLanguage());
192
194 $userObj->setTimeLimitUnlimited(1);
195 $userObj->setTimeLimitFrom(time());
196 $userObj->setTimeLimitUntil(time());
197 $userObj->setOwner(0);
198 $userObj->create();
199 $userObj->setActive(1);
200 $userObj->updateOwner();
201 $userObj->saveAsNew(false);
202 $userObj->writePrefs();
203
204 $this->rbacAdmin->assignUser(
205 $this->
settings->get(
'soap_auth_user_default_role', 4),
206 $userObj->getId()
207 );
208
209 if ($this->
settings->get(
'soap_auth_account_mail',
false)) {
211 $registrationSettings->setPasswordGenerationStatus(true);
212
214 $registrationSettings,
216 $this->logger
217 );
218 $accountMail
219 ->withDirectRegistrationMode()
221 }
222
223 $status->setAuthenticatedUserId($userObj->getId());
224 return true;
225 }
Class ilAccountRegistrationMail.
setTranslatedReason($a_reason)
Set translated reason.
static _generateLogin($a_login)
generate free login by starting with a default string and adding postfix numbers
static _checkExternalAuthAccount($a_auth, $a_account, $tryFallback=true)
check whether external account and authentication method matches with a user
static _lookupId($a_user_str)
Lookup id by login.
Class ilObjAuthSettingsGUI.
static generatePasswords($a_number)
Generate a number of passwords.