105 : bool
106 {
107 $this->
logger->debug(sprintf(
108 'Login observer called for SOAP authentication request of ext_account "%s" and auth_mode "%s".',
110 'soap'
111 ));
112 $this->
logger->debug(sprintf(
113 'Trying to find ext_account "%s" for auth_mode "%s".',
115 'soap'
116 ));
117
119 'soap',
121 );
122
123 $isNewUser = false;
124 if ('' === $internalLogin || null === $internalLogin) {
125 $isNewUser = true;
126 }
127
128 $soapAction = '';
129 $nspref = '';
130 if ($this->use_dot_net) {
131 $soapAction = $this->server_nms . '/isValidSession';
132 $nspref = 'ns1:';
133 }
134
136 'isValidSession',
137 [
140 $nspref . 'new_user' => $isNewUser
141 ],
142 $this->server_nms,
143 $soapAction
144 );
145
147 $valid = [
'valid' =>
false];
148 }
149
150 if (
$valid[
'valid'] !==
true) {
152 }
153
156 return false;
157 }
158
159 if (!$isNewUser) {
161 return true;
162 }
163
164 if (!$this->
settings->get(
'soap_auth_create_users')) {
165
167 return false;
168 }
169
172
173 $password = '';
175 if ($this->
settings->get(
'soap_auth_allow_local')) {
177 $password = $passwords[0];
179 }
180
181 $userObj->setLogin($internalLogin);
182 $userObj->setFirstname($user->getFirstname());
183 $userObj->setLastname($user->getLastname());
184 $userObj->setTitle($userObj->getFullname());
185 $userObj->setDescription($userObj->getEmail());
186 $userObj->setEmail($user->getEmail());
187 $userObj->setPasswd($password, $password_type);
188 $userObj->setAuthMode('soap');
189 $userObj->setExternalAccount($this->
getCredentials()->getUsername());
190 $userObj->setLanguage($this->
language->getDefaultLanguage());
191 $userObj->setProfileIncomplete(true);
192
193 $userObj->setTimeLimitUnlimited(true);
194 $userObj->setTimeLimitFrom(time());
195 $userObj->setTimeLimitUntil(time());
196 $userObj->setOwner(0);
197 $userObj->create();
198 $userObj->setActive(true);
199 $userObj->updateOwner();
200 $userObj->saveAsNew();
201 $userObj->writePrefs();
202
203 $this->rbacAdmin->assignUser(
204 (
int) $this->
settings->get(
'soap_auth_user_default_role',
'4'),
205 $userObj->getId()
206 );
207
208 if ($this->
settings->get(
'soap_auth_account_mail',
'0')) {
210 $registrationSettings->setPasswordGenerationStatus(true);
211
213 $registrationSettings,
215 new NewAccountMailRepository($this->db)
216 );
217 $accountMail
218 ->withDirectRegistrationMode()
219 ->send($userObj, $password, false);
220 }
221
223 return true;
224 }
Class ilAccountRegistrationMail.
setTranslatedReason(string $a_reason)
Set translated reason.
setReason(string $a_reason)
Set reason.
setAuthenticatedUserId(int $a_id)
static _generateLogin(string $a_login)
generate free login by starting with a default string and adding postfix numbers
static _lookupId(string|array $a_user_str)
static _checkExternalAuthAccount(string $a_auth, string $a_account, bool $tryFallback=true)
check whether external account and authentication method matches with a user
Class ilObjAuthSettingsGUI.
static generatePasswords(int $a_number)
Generate a number of passwords.