ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ProvideWithdrawal.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use ilAuthSession;
24 use ilCtrlInterface;
25 use ilSession;
26 use ilStartUpGUI;
27 use Closure;
28 
30 {
32  private readonly Closure $close_session_context;
33 
35  private readonly Closure $logout_url;
36 
41  public function __construct(
42  private readonly string $id,
43  private readonly ilCtrlInterface $ctrl,
44  private readonly ilAuthSession $auth_session,
45  ?Closure $logout_url = null,
46  ?Closure $close_session_context = null
47  ) {
48  $this->logout_url = $logout_url ?? ilStartUpGUI::logoutUrl(...);
49  $this->close_session_context = $close_session_context ?? ilSession::setClosingContext(...);
50  }
51 
52  public function beginProcessURL(): string
53  {
54  return ($this->logout_url)(['withdraw_consent' => $this->id]);
55  }
56 
60  public function finishAndLogout(array $additional_url_parameters = []): void
61  {
63  $this->auth_session->logout();
64 
65  $this->ctrl->redirectToURL('login.php?' . http_build_query(array_merge($additional_url_parameters, [
66  'withdrawal_finished' => $this->id,
67  'cmd' => 'force_login',
68  ])));
69  }
70 }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
finishAndLogout(array $additional_url_parameters=[])
__construct(private readonly string $id, private readonly ilCtrlInterface $ctrl, private readonly ilAuthSession $auth_session, ?Closure $logout_url=null, ?Closure $close_session_context=null)
static logoutUrl(array $parameters=[])
Return the logout URL with a valid CSRF token.
const SESSION_CLOSE_USER
static setClosingContext(int $a_context)
set closing context (for statistics)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23