diff --git a/pandora_console/godmode/users/configure_profile.php b/pandora_console/godmode/users/configure_profile.php index 4cddff8932..82af2e5e8e 100644 --- a/pandora_console/godmode/users/configure_profile.php +++ b/pandora_console/godmode/users/configure_profile.php @@ -39,12 +39,13 @@ if (! check_acl($config['id_user'], 0, 'UM')) { } enterprise_include_once('meta/include/functions_users_meta.php'); - -$tab = get_parameter('tab', 'profile'); -$pure = get_parameter('pure', 0); - +// Get parameters. +$tab = get_parameter('tab', 'profile'); +$pure = get_parameter('pure', 0); +$new_profile = (bool) get_parameter('new_profile'); +$id_profile = (int) get_parameter('id'); // Header. -if (!is_metaconsole()) { +if (is_metaconsole() === false) { $buttons = [ 'user' => [ 'active' => false, @@ -72,13 +73,29 @@ if (!is_metaconsole()) { $buttons[$tab]['active'] = true; - ui_print_page_header( - __('User management').' » '.__('Profiles defined on %s', get_product_name()), + $profile = db_get_row('tperfil', 'id_perfil', $id_profile); + + ui_print_standard_header( + __('Edit profile %s', $profile['name']), 'images/gm_users.png', false, 'configure_profiles_tab', true, - $buttons + $buttons, + [ + [ + 'link' => '', + 'label' => __('Profiles'), + ], + [ + 'link' => '', + 'label' => __('Manage users'), + ], + [ + 'link' => ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/profile_list&tab=profile'), + 'label' => __('User Profile management'), + ], + ] ); $sec2 = 'gusuarios'; } else { @@ -86,10 +103,6 @@ if (!is_metaconsole()) { $sec2 = 'advanced'; } - -$new_profile = (bool) get_parameter('new_profile'); -$id_profile = (int) get_parameter('id'); - // Edit profile. if ($id_profile || $new_profile) { if ($new_profile) { diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 865ab8eb9d..fdfcfd1b3c 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -54,71 +54,27 @@ if ($enterprise_include === true) { enterprise_include_once('meta/include/functions_users_meta.php'); } -if (is_metaconsole() === false) { - date_default_timezone_set('UTC'); - include 'include/javascript/timezonepicker/includes/parser.inc'; - - // Read in options for map builder. - $bases = [ - 'gray' => 'Gray', - 'blue-marble' => 'Blue marble', - 'night-electric' => 'Night Electric', - 'living' => 'Living Earth', - ]; - - $local_file = 'include/javascript/timezonepicker/images/gray-400.png'; - - // Dimensions must always be exact since the imagemap does not scale. - $array_size = getimagesize($local_file); - - $map_width = $array_size[0]; - $map_height = $array_size[1]; - - $timezones = timezone_picker_parse_files( - $map_width, - $map_height, - 'include/javascript/timezonepicker/tz_world.txt', - 'include/javascript/timezonepicker/tz_islands.txt' - ); - - foreach ($timezones as $timezone_name => $tz) { - if ($timezone_name == 'America/Montreal') { - $timezone_name = 'America/Toronto'; - } else if ($timezone_name == 'Asia/Chongqing') { - $timezone_name = 'Asia/Shanghai'; - } - - $area_data_timezone_polys .= ''; - foreach ($tz['polys'] as $coords) { - $area_data_timezone_polys .= ''; - } - - $area_data_timezone_rects .= ''; - foreach ($tz['rects'] as $coords) { - $area_data_timezone_rects .= ''; - } - } -} - // This defines the working user. Beware with this, old code get confusses // and operates with current logged user (dangerous). $id = get_parameter('id', get_parameter('id_user', '')); +// Check if we are the same user for edit or we have a proper profile for edit users. +if ($id !== $config['id_user']) { + if ((bool) check_acl($config['id_user'], 0, 'UM') === false) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Trying to access User Management' + ); + include 'general/noaccess.php'; + + return; + } +} + // ID given as parameter. $pure = get_parameter('pure', 0); - $user_info = get_user_info($id); $is_err = false; -if ((bool) check_acl($config['id_user'], 0, 'UM') === false) { - db_pandora_audit( - AUDIT_LOG_ACL_VIOLATION, - 'Trying to access User Management' - ); - include 'general/noaccess.php'; - - return; -} - if (is_ajax() === true) { $delete_profile = (bool) get_parameter('delete_profile'); $get_user_profile = (bool) get_parameter('get_user_profile'); @@ -270,7 +226,7 @@ enterprise_hook('open_meta_frame'); $tab = get_parameter('tab', 'user'); // Save autorefresh list. -$autorefresh_list = get_parameter_post('autorefresh_list'); +$autorefresh_list = (array) get_parameter_post('autorefresh_list'); $autorefresh_white_list = (($autorefresh_list[0] === '') || ($autorefresh_list[0] === '0')) ? '' : json_encode($autorefresh_list); // Header. @@ -338,6 +294,7 @@ if ((bool) $config['user_can_update_info'] === true) { $view_mode = true; } +$delete_profile = (is_ajax() === true) ? (bool) get_parameter('delete_profile') : false; $new_user = (bool) get_parameter('new_user'); $create_user = (bool) get_parameter('create_user'); $add_profile = (bool) get_parameter('add_profile'); @@ -564,6 +521,7 @@ if ($create_user === true) { $info ); + HD('patatas', true); ui_print_result_message( $result, __('Successfully created'), @@ -1002,7 +960,7 @@ if ($add_profile && empty($json_profile)) { ); } -if ($values) { +if (isset($values) === true && empty($values) === false) { $user_info = $values; } @@ -1530,7 +1488,7 @@ $default_event_filter .= html_print_select( false ).''; -if ($config['ehorus_user_level_conf']) { +if (isset($config['ehorus_user_level_conf']) === true && (bool) $config['ehorus_user_level_conf'] === true) { $ehorus = '
'.__('eHorus user access enabled').'
'; $ehorus .= html_print_checkbox_switch( 'ehorus_user_level_enabled', @@ -1562,7 +1520,7 @@ if ($config['ehorus_user_level_conf']) { $double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $id); -if ($config['double_auth_enabled'] && check_acl($config['id_user'], 0, 'PM')) { +if (isset($config['double_auth_enabled']) === true && (bool) ($config['double_auth_enabled']) === true && check_acl($config['id_user'], 0, 'PM')) { $double_authentication = ''.__('Double authentication').'
'; if (($config['2FA_all_users'] == '' && !$double_auth_enabled) || ($config['double_auth_enabled'] == '' && $double_auth_enabled) @@ -1678,14 +1636,10 @@ if (is_metaconsole() === true) { ).'