ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ProvideWithdrawal.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use ilAuthSession;
24 use ilCtrl;
25 use ilSession;
26 use ilStartUpGUI;
28 use Closure;
29 
31 {
33  private readonly Closure $close_session_context;
34 
36  private readonly Closure $logout_url;
37 
42  public function __construct(
43  private readonly string $id,
44  private readonly ilCtrl $ctrl,
45  private readonly ilAuthSession $auth_session,
46  ?Closure $logout_url = null,
47  ?Closure $close_session_context = null
48  ) {
49  $this->logout_url = $logout_url ?? ilStartUpGUI::logoutUrl(...);
50  $this->close_session_context = $close_session_context ?? ilSession::setClosingContext(...);
51  }
52 
53  public function beginProcessURL(): string
54  {
55  return ($this->logout_url)(['withdraw_consent' => $this->id]);
56  }
57 
61  public function finishAndLogout(array $additional_url_parameters = []): void
62  {
64  $this->auth_session->logout();
65 
66  $this->ctrl->redirectToURL('login.php?' . http_build_query(array_merge($additional_url_parameters, [
67  'withdrawal_finished' => $this->id,
68  'cmd' => 'force_login',
69  ])));
70  }
71 }
finishAndLogout(array $additional_url_parameters=[])
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
__construct(private readonly string $id, private readonly ilCtrl $ctrl, private readonly ilAuthSession $auth_session, ?Closure $logout_url=null, ?Closure $close_session_context=null)