19 declare(strict_types=1);
    83         $this->db = $DIC->database();
    85         $this->review = $DIC->rbac()->review();
    86         $this->https = $DIC[
'https'];
    98         if (!self::$instance instanceof 
self) {
    99             self::$instance = 
new self();
   101         return self::$instance;
   110         $this->password_chars_and_numbers_enabled = $a_chars_and_numbers_enabled;
   128         $this->password_special_chars_enabled = $a_password_special_chars_enabled;
   145         $this->password_min_length = $a_password_min_length;
   161         $this->password_max_length = $a_password_max_length;
   177         $this->password_max_age = $a_password_max_age;
   193         $this->login_max_attempts = $a_login_max_attempts;
   209         $this->https_enable = $value;
   226         $this->password_change_on_first_login_enabled = $a_password_change_on_first_login_enabled;
   245         $this->protect_admin_role = $a_stat;
   278             'ps_password_must_not_contain_loginame',
   283             'ps_password_change_on_first_login_enabled',
   297         $query = 
"SELECT object_reference.ref_id FROM object_reference,tree,object_data " .
   298             "WHERE tree.parent = " . $this->db->quote(
SYSTEM_FOLDER_ID, 
'integer') . 
" " .
   299             "AND object_data.type = 'ps' " .
   300             "AND object_reference.ref_id = tree.child " .
   301             "AND object_reference.obj_id = object_data.obj_id";
   302         $res = $this->db->query($query);
   305         $this->https_enable = (bool) $this->
settings->get(
'https', null);
   307         $this->password_chars_and_numbers_enabled = (bool) $this->
settings->get(
   308             'ps_password_chars_and_numbers_enabled',
   309             (
string) self::DEFAULT_PASSWORD_CHARS_AND_NUMBERS_ENABLED
   311         $this->password_special_chars_enabled = (bool) $this->
settings->get(
   312             'ps_password_special_chars_enabled',
   313             (
string) self::DEFAULT_PASSWORD_SPECIAL_CHARS_ENABLED
   315         $this->password_min_length = (
int) $this->
settings->get(
   316             'ps_password_min_length',
   317             (
string) self::DEFAULT_PASSWORD_MIN_LENGTH
   319         $this->password_max_length = (
int) $this->
settings->get(
   320             'ps_password_max_length',
   321             (
string) self::DEFAULT_PASSWORD_MAX_LENGTH
   323         $this->password_max_age = (
int) $this->
settings->get(
'ps_password_max_age', (
string) self::DEFAULT_PASSWORD_MAX_AGE);
   324         $this->login_max_attempts = (
int) $this->
settings->get(
   325             'ps_login_max_attempts',
   326             (
string) self::DEFAULT_LOGIN_MAX_ATTEMPTS
   328         $this->password_ucase_chars_num = (
int) $this->
settings->get(
'ps_password_uppercase_chars_num', 
"0");
   329         $this->password_lcase_chars_num = (
int) $this->
settings->get(
'ps_password_lowercase_chars_num', 
"0");
   330         $this->password_must_not_contain_loginname = (bool) $this->
settings->get(
   331             'ps_password_must_not_contain_loginame',
   334         $this->password_change_on_first_login_enabled = (bool) $this->
settings->get(
   335             'ps_password_change_on_first_login_enabled',
   336             (
string) self::DEFAULT_PASSWORD_CHANGE_ON_FIRST_LOGIN_ENABLED
   338         $this->prevent_simultaneous_logins = (bool) $this->
settings->get(
   339             'ps_prevent_simultaneous_logins',
   340             (
string) self::DEFAULT_PREVENT_SIMULTANEOUS_LOGINS
   342         $this->protect_admin_role = (bool) $this->
settings->get(
'ps_protect_admin', (
string) $this->protect_admin_role);
   355             if (!$this->https->checkHTTPS()) {
   360                     $a_form->getItemByPostVar(
'https_enabled')
   367             $code = self::SECURITY_SETTINGS_ERR_CODE_INVALID_PASSWORD_MIN_LENGTH;
   371                 $a_form->getItemByPostVar(
'password_min_length')
   377             $code = self::SECURITY_SETTINGS_ERR_CODE_INVALID_PASSWORD_MAX_LENGTH;
   381                 $a_form->getItemByPostVar(
'password_max_length')
   386         $password_min_length = 1;
   387         $password_min_length_error_code = null;
   390             $password_min_length = 0;
   397             $password_min_length_error_code = self::SECURITY_SETTINGS_ERR_CODE_PASSWORD_MIN_LENGTH_MIN1;
   401             $password_min_length++;
   402             $password_min_length_error_code = self::SECURITY_SETTINGS_ERR_CODE_PASSWORD_MIN_LENGTH_MIN2;
   405                 $password_min_length++;
   406                 $password_min_length_error_code = self::SECURITY_SETTINGS_ERR_CODE_PASSWORD_MIN_LENGTH_MIN3;
   409             $password_min_length++;
   410             $password_min_length_error_code = self::SECURITY_SETTINGS_ERR_CODE_PASSWORD_MIN_LENGTH_MIN3;
   414             $code = $password_min_length_error_code;
   418                 $a_form->getItemByPostVar(
'password_min_length')
   423             $code = self::SECURITY_SETTINGS_ERR_CODE_PASSWORD_MAX_LENGTH_LESS_MIN_LENGTH;
   427                 $a_form->getItemByPostVar(
'password_max_length')
   432             $code = self::SECURITY_SETTINGS_ERR_CODE_INVALID_PASSWORD_MAX_AGE;
   436                 $a_form->getItemByPostVar(
'password_max_age')
   442             $code = self::SECURITY_SETTINGS_ERR_CODE_INVALID_LOGIN_MAX_ATTEMPTS;
   446                 $a_form->getItemByPostVar(
'login_max_attempts')
   477         $this->prevent_simultaneous_logins = $value;
   517         $this->password_must_not_contain_loginname = (bool) $status;
 
bool $password_must_not_contain_loginname
 
setPasswordSpecialCharsEnabled(bool $a_password_special_chars_enabled)
set if the passwords have to contain special characters 
 
const SECURITY_SETTINGS_ERR_CODE_PASSWORD_MIN_LENGTH_MIN2
 
const SECURITY_SETTINGS_ERR_CODE_INVALID_PASSWORD_MIN_LENGTH
 
checkAdminRoleAccessible(int $a_usr_id)
Check if the administrator role is accessible for a specific user. 
 
Singleton class that stores all security settings. 
 
isHTTPSEnabled()
read access to https enabled property 
 
const SECURITY_SETTINGS_ERR_CODE_INVALID_PASSWORD_MAX_LENGTH
 
const DEFAULT_PASSWORD_MAX_LENGTH
 
setPasswordChangeOnFirstLoginEnabled(bool $a_password_change_on_first_login_enabled)
set if the passwords have to be changed by users on first login 
 
isPasswordCharsAndNumbersEnabled()
get boolean if the passwords have to contain characters and numbers 
 
const DEFAULT_PASSWORD_MAX_AGE
 
setPasswordNumberOfLowercaseChars(int $password_lcase_chars_num)
Set number of lowercase characters required. 
 
__construct()
Private constructor: use _getInstance() 
 
validate(ilPropertyFormGUI $a_form=null)
validate settings 
 
bool $password_change_on_first_login_enabled
 
static int $SECURITY_SETTINGS_ERR_CODE_HTTP_NOT_AVAILABLE
 
const DEFAULT_LOGIN_MAX_ATTEMPTS
 
const SECURITY_SETTINGS_ERR_CODE_INVALID_PASSWORD_MAX_AGE
 
bool $prevent_simultaneous_logins
 
setPasswordMaxLength(int $a_password_max_length)
set the maximum length for passwords 
 
static int $SECURITY_SETTINGS_ERR_CODE_AUTO_HTTPS
 
getPasswordMaxLength()
get the maximum length for passwords 
 
bool $password_chars_and_numbers_enabled
 
setPasswordNumberOfUppercaseChars(int $password_ucase_chars_num)
Set number of uppercase characters required. 
 
isPasswordChangeOnFirstLoginEnabled()
get boolean if the passwords have to be changed by users on first login 
 
getPasswordNumberOfLowercaseChars()
Returns number of lowercase characters required. 
 
setHTTPSEnabled(bool $value)
Enable https for certain scripts. 
 
static getErrorMessage(int $code)
return error message for error code 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getPasswordNumberOfUppercaseChars()
Returns number of uppercase characters required. 
 
isPasswordSpecialCharsEnabled()
get boolean if the passwords have to contain special characters 
 
getPasswordMinLength()
get the minimum length for passwords 
 
const DEFAULT_PASSWORD_SPECIAL_CHARS_ENABLED
 
bool $password_special_chars_enabled
 
setPasswordMaxAge(int $a_password_max_age)
set the maximum password age 
 
const DEFAULT_PASSWORD_MIN_LENGTH
 
setLoginMaxAttempts(int $a_login_max_attempts)
set the maximum count of login attempts 
 
getPasswordMaxAge()
get the maximum password age 
 
int $password_lcase_chars_num
 
setPasswordMinLength(int $a_password_min_length)
set the minimum length for passwords 
 
isPreventionOfSimultaneousLoginsEnabled()
Prevention of simultaneous logins with the same account. 
 
setPasswordMustNotContainLoginnameStatus($status)
Set whether the password must not contain the loginname or not. 
 
const SECURITY_SETTINGS_ERR_CODE_PASSWORD_MIN_LENGTH_MIN3
 
static int $SECURITY_SETTINGS_ERR_CODE_HTTPS_NOT_AVAILABLE
 
setPreventionOfSimultaneousLogins(bool $value)
Enable/Disable prevention of simultaneous logins with the same account. 
 
const DEFAULT_PREVENT_SIMULTANEOUS_LOGINS
 
const SECURITY_SETTINGS_ERR_CODE_INVALID_LOGIN_MAX_ATTEMPTS
 
const SECURITY_SETTINGS_ERR_CODE_PASSWORD_MIN_LENGTH_MIN1
 
const SECURITY_SETTINGS_ERR_CODE_PASSWORD_MAX_LENGTH_LESS_MIN_LENGTH
 
getLoginMaxAttempts()
get the maximum count of login attempts 
 
setPasswordCharsAndNumbersEnabled(bool $a_chars_and_numbers_enabled)
set if the passwords have to contain characters and numbers 
 
protectedAdminRole(bool $a_stat)
 
read()
read settings  private 
 
static _getInstance()
Get instance of ilSecuritySettings. 
 
getPasswordMustNotContainLoginnameStatus()
Return whether the password must not contain the loginname or not. 
 
int $password_ucase_chars_num
 
const DEFAULT_PASSWORD_CHANGE_ON_FIRST_LOGIN_ENABLED
 
const DEFAULT_PASSWORD_CHARS_AND_NUMBERS_ENABLED