19 declare(strict_types=1);
44 private readonly
User $user,
45 private readonly
UI $ui,
46 private readonly
Routing $routing,
48 private readonly
Closure $query_parameter,
49 private readonly
Provide $legal_documents,
50 private readonly
Closure $after_user_withdrawal
57 if ($status ===
null) {
60 $lng =
'withdraw_consent_description_' . ($status ===
'external' ?
'external' :
'internal');
63 $this->
ui->create()->divider()->horizontal(),
64 $this->
ui->create()->legacy()->content($this->
ui->txt(
$lng))
70 return $this->
user->withdrawalRequested()->value();
75 if ($this->
user->cannotAgree() || $this->
user->neverAgreed()) {
79 $this->
user->withdrawalRequested()->update(
true);
81 $external = $this->
user->isExternalAccount();
83 return $external ?
'external' :
'internal';
88 $type = $this->
query(
'tos_withdrawal_type');
90 $this->
ui->mainTemplate()->setOnScreenMessage(
'info', match ($type) {
91 'delete_user' => $this->
ui->txt(
'withdrawal_complete_deleted'),
92 'external' => $this->
ui->txt(
'withdrawal_complete_redirect'),
93 null,
'default' => $this->
ui->txt(
'withdrawal_complete'),
108 $this->
user->agreeDate()->update(
null);
109 $this->
user->withdrawalRequested()->update(
false);
111 $withdrawal_type =
'default';
112 if ($this->
user->isLDAPUser()) {
114 $withdrawal_type =
'external';
115 } elseif ($this->
settings->deleteUserOnWithdrawal()->value()) {
116 $this->
user->raw()->delete();
117 $withdrawal_type =
'delete_user';
120 ($this->after_user_withdrawal)();
122 $this->legal_documents->withdrawal()->finishAndLogout([
'tos_withdrawal_type' => $withdrawal_type]);
127 $this->
user->withdrawalRequested()->update(
false);
128 $this->routing->redirectToOriginalTarget();
133 $title = $this->
ui->txt(
'refuse_acceptance');
135 if ($this->
user->isLDAPUser()) {
137 $this->
ui->create()->panel()->standard($this->
ui->txt(
'withdraw_usr_agreement'), [
139 $this->
ui->create()->divider()->horizontal(),
140 $this->
ui->create()->legacy()->content(nl2br($this->
user->format($this->ui->txt(
'withdrawal_mail_info') . $this->
ui->txt(
'withdrawal_mail_text'))))
145 $deletion = $this->
settings->deleteUserOnWithdrawal()->value() ?
'_deletion' :
'';
151 $lng_suffix = $this->
user->neverAgreed() ?
'_no_consent_yet' :
'';
152 $question =
'withdrawal_sure_account' . $add_to_question . $lng_suffix;
154 return $this->
ui->create()->messageBox()->confirmation($this->
ui->txt($question))->withButtons([
155 $this->
ui->create()->button()->standard(
156 $this->
ui->txt(
'confirm'),
157 $this->routing->ctrl()->getLinkTargetByClass($gui,
'indeed')
159 $this->
ui->create()->button()->standard(
160 $this->
ui->txt(
'cancel'),
161 $this->routing->ctrl()->getLinkTargetByClass($gui,
'cancel')
169 $mail->setRecipients([$this->
settings->adminEmail()->value()]);
170 $mail->sendGeneric($this->
ui->txt(
'withdrawal_mail_subject'), $this->
user->format($this->
ui->txt(
'withdrawal_mail_text')));
173 private function query(
string $query_parameter): ?string
175 return ($this->query_parameter)($query_parameter, fn(
Refinery $r) => $r->byTrying([
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
RFC 822 Email address list validation Utility.