19declare(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();
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',
311 $this->password_special_chars_enabled = (bool) $this->
settings->get(
312 'ps_password_special_chars_enabled',
315 $this->password_min_length = (
int) $this->
settings->get(
316 'ps_password_min_length',
319 $this->password_max_length = (
int) $this->
settings->get(
320 'ps_password_max_length',
324 $this->login_max_attempts = (
int) $this->
settings->get(
325 'ps_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',
338 $this->prevent_simultaneous_logins = (bool) $this->
settings->get(
339 'ps_prevent_simultaneous_logins',
355 if (!$this->https->checkHTTPS()) {
360 $a_form->getItemByPostVar(
'https_enabled')
371 $a_form->getItemByPostVar(
'password_min_length')
381 $a_form->getItemByPostVar(
'password_max_length')
387 $password_min_length_error_code =
null;
390 $password_min_length = 0;
401 $password_min_length++;
405 $password_min_length++;
409 $password_min_length++;
414 $code = $password_min_length_error_code;
418 $a_form->getItemByPostVar(
'password_min_length')
427 $a_form->getItemByPostVar(
'password_max_length')
436 $a_form->getItemByPostVar(
'password_max_age')
446 $a_form->getItemByPostVar(
'login_max_attempts')
477 $this->prevent_simultaneous_logins = $value;
517 $this->password_must_not_contain_loginname = (bool) $status;
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getErrorMessage(int $code)
return error message for error code
class ilRbacReview Contains Review functions of core Rbac.
Singleton class that stores all security settings.
const SECURITY_SETTINGS_ERR_CODE_PASSWORD_MIN_LENGTH_MIN2
setPasswordNumberOfUppercaseChars(int $password_ucase_chars_num)
Set number of uppercase characters required.
isPasswordSpecialCharsEnabled()
get boolean if the passwords have to contain special characters
const DEFAULT_PASSWORD_MAX_LENGTH
getLoginMaxAttempts()
get the maximum count of login attempts
setPasswordMaxLength(int $a_password_max_length)
set the maximum length for passwords
setLoginMaxAttempts(int $a_login_max_attempts)
set the maximum count of login attempts
setPasswordMinLength(int $a_password_min_length)
set the minimum length for passwords
getPasswordMustNotContainLoginnameStatus()
Return whether the password must not contain the loginname or not.
setPreventionOfSimultaneousLogins(bool $value)
Enable/Disable prevention of simultaneous logins with the same account.
static int $SECURITY_SETTINGS_ERR_CODE_HTTP_NOT_AVAILABLE
validate(?ilPropertyFormGUI $a_form=null)
validate settings
bool $password_chars_and_numbers_enabled
bool $password_special_chars_enabled
const SECURITY_SETTINGS_ERR_CODE_INVALID_LOGIN_MAX_ATTEMPTS
checkAdminRoleAccessible(int $a_usr_id)
Check if the administrator role is accessible for a specific user.
int $password_ucase_chars_num
getPasswordMinLength()
get the minimum length for passwords
int $password_lcase_chars_num
setHTTPSEnabled(bool $value)
Enable https for certain scripts.
read()
read settings @access private
static int $SECURITY_SETTINGS_ERR_CODE_HTTPS_NOT_AVAILABLE
const SECURITY_SETTINGS_ERR_CODE_INVALID_PASSWORD_MAX_LENGTH
const SECURITY_SETTINGS_ERR_CODE_PASSWORD_MIN_LENGTH_MIN3
static int $SECURITY_SETTINGS_ERR_CODE_AUTO_HTTPS
getPasswordMaxLength()
get the maximum length for passwords
setPasswordMustNotContainLoginnameStatus($status)
Set whether the password must not contain the loginname or not.
isPreventionOfSimultaneousLoginsEnabled()
Prevention of simultaneous logins with the same account.
const DEFAULT_PASSWORD_CHARS_AND_NUMBERS_ENABLED
getPasswordNumberOfUppercaseChars()
Returns number of uppercase characters required.
const DEFAULT_PASSWORD_SPECIAL_CHARS_ENABLED
isHTTPSEnabled()
read access to https enabled property
const SECURITY_SETTINGS_ERR_CODE_INVALID_PASSWORD_MAX_AGE
isPasswordCharsAndNumbersEnabled()
get boolean if the passwords have to contain characters and numbers
isPasswordChangeOnFirstLoginEnabled()
get boolean if the passwords have to be changed by users on first login
setPasswordCharsAndNumbersEnabled(bool $a_chars_and_numbers_enabled)
set if the passwords have to contain characters and numbers
bool $password_must_not_contain_loginname
const DEFAULT_LOGIN_MAX_ATTEMPTS
bool $prevent_simultaneous_logins
bool $password_change_on_first_login_enabled
setPasswordChangeOnFirstLoginEnabled(bool $a_password_change_on_first_login_enabled)
set if the passwords have to be changed by users on first login
setPasswordNumberOfLowercaseChars(int $password_lcase_chars_num)
Set number of lowercase characters required.
const SECURITY_SETTINGS_ERR_CODE_PASSWORD_MAX_LENGTH_LESS_MIN_LENGTH
getPasswordMaxAge()
get the maximum password age
const DEFAULT_PASSWORD_MAX_AGE
const DEFAULT_PREVENT_SIMULTANEOUS_LOGINS
const DEFAULT_PASSWORD_CHANGE_ON_FIRST_LOGIN_ENABLED
const SECURITY_SETTINGS_ERR_CODE_PASSWORD_MIN_LENGTH_MIN1
const SECURITY_SETTINGS_ERR_CODE_INVALID_PASSWORD_MIN_LENGTH
static _getInstance()
Get instance of ilSecuritySettings.
protectedAdminRole(bool $a_stat)
getPasswordNumberOfLowercaseChars()
Returns number of lowercase characters required.
setPasswordMaxAge(int $a_password_max_age)
set the maximum password age
__construct()
Private constructor: use _getInstance()
setPasswordSpecialCharsEnabled(bool $a_password_special_chars_enabled)
set if the passwords have to contain special characters
const DEFAULT_PASSWORD_MIN_LENGTH