ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
SessionAuthenticatedUser.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27
31final readonly class SessionAuthenticatedUser implements AuthenticatedUser
32{
33 public function __construct(private \ilAuthSession $auth_session)
34 {
35 }
36
37 public function id(): Result
38 {
39 if ($this->auth_session->isFullyAuthenticated()) {
40 return new Ok($this->auth_session->getUserId());
41 }
42
43 if ($this->auth_session->isAnonymouslyAuthenticated()) {
44 return new Error('Anonymous session actor is not an authenticated user.');
45 }
46
47 return new Error('No authenticated user in session.');
48 }
49}
Answers the query from the legacy session authentication.
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Ok.php:31
Query port for a fully authenticated ILIAS user in the current request.
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:29