ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilAuthStatus.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
23  private static ?ilAuthStatus $instance = null;
24 
25  private ilLanguage $lng;
26 
27  public const int STATUS_UNDEFINED = 1;
28  public const int STATUS_AUTHENTICATED = 2;
29  public const int STATUS_AUTHENTICATION_FAILED = 3;
30  public const int STATUS_ACCOUNT_MIGRATION_REQUIRED = 4;
31  public const int STATUS_CODE_ACTIVATION_REQUIRED = 5;
32 
33  private int $status = self::STATUS_UNDEFINED;
34  private string $reason = '';
35  private string $translated_reason = '';
36  private int $auth_user_id = 0;
37 
38 
39 
43  private function __construct()
44  {
45  global $DIC;
46  $this->lng = $DIC->language();
47  }
48 
52  public static function getInstance(): ilAuthStatus
53  {
54  if (self::$instance) {
55  return self::$instance;
56  }
57  return self::$instance = new ilAuthStatus();
58  }
59 
63  public function setStatus(int $a_status): void
64  {
65  $this->status = $a_status;
66  }
67 
72  public function getStatus(): int
73  {
74  return $this->status;
75  }
76 
81  public function setReason(string $a_reason): void
82  {
83  $this->reason = $a_reason;
84  }
85 
89  public function setTranslatedReason(string $a_reason): void
90  {
91  $this->translated_reason = $a_reason;
92  }
93 
97  public function getReason(): string
98  {
99  return $this->reason;
100  }
101 
105  public function getTranslatedReason(): string
106  {
107  if ($this->translated_reason !== '') {
109  }
110  return $this->lng->txt($this->getReason());
111  }
112 
113 
114  public function setAuthenticatedUserId(int $a_id): void
115  {
116  $this->auth_user_id = $a_id;
117  }
118 
122  public function getAuthenticatedUserId(): int
123  {
124  return $this->auth_user_id;
125  }
126 }
getReason()
Get reason for authentication success, fail, migration...
static ilAuthStatus $instance
const int STATUS_AUTHENTICATED
getAuthenticatedUserId()
Get authenticated user id.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getTranslatedReason()
Get translated reason.
setStatus(int $a_status)
Set auth status.
getStatus()
Get status.
global $DIC
Definition: shib_login.php:26
const int STATUS_CODE_ACTIVATION_REQUIRED
const int STATUS_AUTHENTICATION_FAILED
static getInstance()
Get status instance.
const int STATUS_UNDEFINED
setTranslatedReason(string $a_reason)
Set translated reason.
setReason(string $a_reason)
Set reason.
setAuthenticatedUserId(int $a_id)
__construct()
Constructor.
const int STATUS_ACCOUNT_MIGRATION_REQUIRED