ILIAS  release_8 Revision v8.24
class.ilAuthStatus.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
28{
29 private static ?ilAuthStatus $instance = null;
30
32
33 public const STATUS_UNDEFINED = 1;
34 public const STATUS_AUTHENTICATED = 2;
38
40 private string $reason = '';
41 private string $translated_reason = '';
42 private int $auth_user_id = 0;
43
44
45
49 private function __construct()
50 {
51 global $DIC;
52 $this->lng = $DIC->language();
53 }
54
58 public static function getInstance(): ilAuthStatus
59 {
60 if (self::$instance) {
61 return self::$instance;
62 }
63 return self::$instance = new ilAuthStatus();
64 }
65
69 public function setStatus(int $a_status): void
70 {
71 $this->status = $a_status;
72 }
73
78 public function getStatus(): int
79 {
80 return $this->status;
81 }
82
87 public function setReason(string $a_reason): void
88 {
89 $this->reason = $a_reason;
90 }
91
95 public function setTranslatedReason(string $a_reason): void
96 {
97 $this->translated_reason = $a_reason;
98 }
99
103 public function getReason(): string
104 {
105 return $this->reason;
106 }
107
111 public function getTranslatedReason(): string
112 {
113 if ($this->translated_reason !== '') {
115 }
116 return $this->lng->txt($this->getReason());
117 }
118
119
120 public function setAuthenticatedUserId(int $a_id): void
121 {
122 $this->auth_user_id = $a_id;
123 }
124
128 public function getAuthenticatedUserId(): int
129 {
130 return $this->auth_user_id;
131 }
132}
Auth status implementation.
getReason()
Get reason for authentication success, fail, migration...
static ilAuthStatus $instance
getStatus()
Get status.
setTranslatedReason(string $a_reason)
Set translated reason.
const STATUS_CODE_ACTIVATION_REQUIRED
__construct()
Constructor.
setReason(string $a_reason)
Set reason.
setAuthenticatedUserId(int $a_id)
setStatus(int $a_status)
Set auth status.
getTranslatedReason()
Get translated reason.
getAuthenticatedUserId()
Get authenticated user id.
static getInstance()
Get status instance.
const STATUS_AUTHENTICATION_FAILED
const STATUS_ACCOUNT_MIGRATION_REQUIRED
language handling
global $DIC
Definition: feed.php:28