19 declare(strict_types=1);
34 'session_allow_client_maintenance',
55 self::SESSION_TYPE_USER,
56 self::SESSION_TYPE_ANONYM
60 self::SESSION_TYPE_UNKNOWN,
61 self::SESSION_TYPE_SYSTEM,
62 self::SESSION_TYPE_ADMIN
72 case isset($_ENV[
'SHELL']):
73 $type = self::SESSION_TYPE_SYSTEM;
77 $type = self::SESSION_TYPE_ANONYM;
80 case self::checkAdministrationPermission(
$user_id):
81 $type = self::SESSION_TYPE_ADMIN;
85 $type = self::SESSION_TYPE_USER;
90 self::debug(__METHOD__ .
' --> update sessions type to (' . $type .
')');
109 $ilDB = $DIC[
'ilDB'];
113 $query =
'SELECT count(session_id) AS num_sessions FROM usr_session ' .
114 'WHERE expires > %s ' .
115 'AND ' .
$ilDB->in(
'type', $a_types,
false,
'integer');
117 $res =
$ilDB->queryF($query, [
'integer'], [$ts]);
125 $ilDB = $DIC[
'ilDB'];
127 $query =
'SELECT session_id, expires FROM usr_session ' .
128 'WHERE session_id = %s';
130 $res =
$ilDB->queryF($query, [
'text'], [$a_sid]);
137 if ($row[
'expires'] > $ts) {
138 self::debug(__METHOD__ .
' --> Found a valid session with id (' . $a_sid .
')');
141 self::debug(__METHOD__ .
' --> Found an expired session with id (' . $a_sid .
')');
145 if (count($sessions) === 1) {
146 self::debug(__METHOD__ .
' --> Exact one valid session found for session id (' . $a_sid .
')');
151 if (count($sessions) > 1) {
152 self::debug(__METHOD__ .
' --> Strange!!! More than one sessions found for given session id! (' . $a_sid .
')');
154 self::debug(__METHOD__ .
' --> No valid session found for session id (' . $a_sid .
')');
163 self::debug(
'Session cookie has been removed');
174 $rbacsystem = $DIC[
'rbacsystem'];
176 $access = $rbacsystem->checkAccessOfUser(
185 private static function debug(
string $a_debug_log_message): void
189 $logger = $DIC->logger()->auth();
191 $logger->debug($a_debug_log_message);
199 return self::$setting_fields;
static removeSessionCookie()
const int SESSION_TYPE_USER
const int SESSION_TYPE_SYSTEM
const int SESSION_TYPE_ADMIN
static checkAdministrationPermission(int $a_user_id)
static _lookupId($a_user_str)
static getSettingFields()
const string SESSION_TYPE_KEY
const int SESSION_TYPE_UNKNOWN
session types from which one is assigned to each session
const int DEFAULT_ALLOW_CLIENT_MAINTENANCE
static setCookie(string $a_cookie_name, string $a_cookie_value='', bool $a_also_set_super_global=true, bool $a_set_cookie_invalid=false)
const int DEFAULT_MIN_IDLE
default value for settings that have not been defined in setup or administration yet ...
static array $setting_fields
static isValidSession(string $a_sid)
static getExistingSessionCount(array $a_types)
static handleLoginEvent(string $a_login, ilAuthSession $auth_session)
static array $session_types_controlled
static array $session_types_not_controlled
all session types that will be involved when count of sessions will be determined or when idleing ses...
const int SESSION_TYPE_ANONYM
static handleLogoutEvent()
reset sessions type to unknown
static set(string $a_var, $a_val)
Set a value.
static debug(string $a_debug_log_message)