Added session coocki to users. Ticket GitLab #120

This commit is contained in:
Arturo Gonzalez 2016-11-23 10:13:02 +01:00
parent 6c5c6d264c
commit 751b73adcb
5 changed files with 22 additions and 3 deletions

View File

@ -125,6 +125,7 @@ if ($new_user && $config['admin_can_add_user']) {
$user_info['language'] = 'default';
$user_info["not_login"] = false;
$user_info["strict_acl"] = false;
$user_info["session_time"] = 0;
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
$user_info['id_skin'] = '';
}
@ -175,6 +176,7 @@ if ($create_user) {
}
$values["not_login"] = (bool)get_parameter ('not_login', false);
$values["strict_acl"] = (bool)get_parameter ('strict_acl', false);
$values["session_time"] = get_parameter('session_time', 0);
if ($id == '') {
ui_print_error_message (__('User ID cannot be empty'));
@ -278,6 +280,7 @@ if ($update_user) {
}
$values["not_login"] = (bool)get_parameter ('not_login', false);
$values["strict_acl"] = (bool)get_parameter ('strict_acl', false);
$values["session_time"] = get_parameter('session_time', 0);
$res1 = update_user ($id, $values);
@ -540,6 +543,10 @@ $table->data[13][1] = html_print_checkbox('not_login', 1, $user_info["not_login"
$table->data[14][0] = __('Strict ACL');
$table->data[14][0] .= ui_print_help_tip(__('With this option enabled, the user will can access to accurate information. It is not recommended for admin users because performance could be affected'), true);
$table->data[14][1] = html_print_checkbox('strict_acl', 1, $user_info["strict_acl"], true);
$table->data[15][0] = __('Session Time');
$table->data[15][0] .= ui_print_help_tip(__('This is defined in minutes, If you wish a permanent session should putting -1 in this field.'), true);
$table->data[15][1] = html_print_input_text ('session_time', $user_info["session_time"], '', 5, 5, true);
if($meta) {
enterprise_include('include/functions_metaconsole.php');

View File

@ -1882,8 +1882,17 @@ function config_user_set_custom_config() {
function config_prepare_session() {
global $config;
// Change the session timeout value to session_timeout minutes // 8*60*60 = 8 hours
$sessionCookieExpireTime = $config["session_timeout"];
$user = users_get_user_by_id($config["id_user"]);
$user_sesion_time = $user['session_time'];
if ($user_sesion_time == 0) {
// Change the session timeout value to session_timeout minutes // 8*60*60 = 8 hours
$sessionCookieExpireTime = $config["session_timeout"];
}
else {
// Change the session timeout value to session_timeout minutes // 8*60*60 = 8 hours
$sessionCookieExpireTime = $user_sesion_time;
}
if ($sessionCookieExpireTime <= 0)
$sessionCookieExpireTime = 10 * 365 * 24 * 60 * 60;

View File

@ -1128,6 +1128,7 @@ CREATE TABLE tusuario (
metaconsole_assigned_server NUMBER(10, 0) DEFAULT 0,
metaconsole_access_node NUMBER(10, 0) DEFAULT 0,
strict_acl NUMBER(5,0) DEFAULT 0,
session_time NUMBER(10,0) DEFAULT 0,
CONSTRAINT t_usuario_metaconsole_acc_cons CHECK (metaconsole_access IN ('basic','advanced'))
);

View File

@ -935,7 +935,8 @@ CREATE TABLE "tusuario" (
"metaconsole_assigned_server" INTEGER NOT NULL default 0,
"metaconsole_access_node" SMALLINT DEFAULT 0,
"metaconsole_access" type_tusuario_metaconsole_access default 'basic',
"strict_acl" SMALLINT DEFAULT 0
"strict_acl" SMALLINT DEFAULT 0,
"session_time" INTEGER DEFAULT 0
);
-- -----------------------------------------------------

View File

@ -1041,6 +1041,7 @@ CREATE TABLE IF NOT EXISTS `tusuario` (
`metaconsole_access_node` tinyint(1) unsigned NOT NULL default 0,
`strict_acl` tinyint(1) unsigned NOT NULL DEFAULT 0,
`id_filter` int(10) unsigned NULL default NULL,
`session_time` int(10) unsigned NOT NULL default 0,
CONSTRAINT `fk_filter_id` FOREIGN KEY (`id_filter`) REFERENCES tevent_filter (`id_filter`) ON DELETE SET NULL,
UNIQUE KEY `id_user` (`id_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;