ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAuthStatus.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 private static ?ilAuthStatus $instance = null;
24
26
27 public const int STATUS_UNDEFINED = 1;
28 public const int STATUS_AUTHENTICATED = 2;
29 public const int STATUS_AUTHENTICATION_FAILED = 3;
31 public const int STATUS_CODE_ACTIVATION_REQUIRED = 5;
32
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
getStatus()
Get status.
setTranslatedReason(string $a_reason)
Set translated reason.
const int STATUS_UNDEFINED
const int STATUS_AUTHENTICATION_FAILED
const int STATUS_CODE_ACTIVATION_REQUIRED
const int STATUS_ACCOUNT_MIGRATION_REQUIRED
__construct()
Constructor.
setReason(string $a_reason)
Set reason.
setAuthenticatedUserId(int $a_id)
setStatus(int $a_status)
Set auth status.
getTranslatedReason()
Get translated reason.
const int STATUS_AUTHENTICATED
getAuthenticatedUserId()
Get authenticated user id.
static getInstance()
Get status instance.
language handling
global $DIC
Definition: shib_login.php:26