fix profiles and users pandora_enterprise#10803

This commit is contained in:
daniel 2023-04-14 10:02:41 +02:00
parent c84e416f44
commit 976633bc4f
4 changed files with 38 additions and 40 deletions

View File

@ -65,7 +65,7 @@ if (is_ajax() === true) {
$group = [
'id_grupo' => 0,
'nombre' => 'None',
'icon' => 'world',
'icon' => 'world@svg.svg',
'parent' => 0,
'disabled' => 0,
'custom_id' => null,

View File

@ -344,7 +344,7 @@ if ($new_user === true && (bool) $config['admin_can_add_user'] === true) {
$user_info['metaconsole_access_node'] = 0;
}
if ((bool) $config['ehorus_user_level_conf'] === true) {
if (isset($config['ehorus_user_level_conf']) === true && (bool) $config['ehorus_user_level_conf'] === true) {
$user_info['ehorus_user_level_user'] = '';
$user_info['ehorus_user_level_pass'] = '';
$user_info['ehorus_user_level_enabled'] = true;
@ -1247,7 +1247,7 @@ $allowedIP .= ui_print_help_tip(__('Add the source IPs that will allow console a
$allowedIP .= html_print_checkbox_switch(
'allowed_ip_active',
0,
$user_info['allowed_ip_active'],
($user_info['allowed_ip_active'] ?? 0),
true
);
$allowedIP .= '</p>';
@ -1255,7 +1255,7 @@ $allowedIP .= html_print_textarea(
'allowed_ip_list',
2,
65,
$user_info['allowed_ip_list'],
($user_info['allowed_ip_list'] ?? 0),
(((bool) $view_mode === true) ? 'readonly="readonly"' : ''),
true
);
@ -1323,20 +1323,6 @@ $home_screen = '<div class="label_select"><p class="edit_user_labels">'.__('Home
true
).'</p>';
/*
$home_screen .= html_print_select(
$values,
'section',
io_safe_output($user_info['section']),
'show_data_section();',
'',
-1,
true,
false,
false
).'</div>';
*/
$dashboards = Manager::getDashboards(
-1,
-1,
@ -1358,7 +1344,6 @@ $home_screen .= '<div id="show_db" style="display: none; width: 100%;">';
$home_screen .= html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true);
$home_screen .= '</div>';
$layouts = visual_map_get_user_layouts($config['id_user'], true);
$layouts_aux = [];
if ($layouts === false) {
@ -1459,7 +1444,7 @@ $default_event_filter = '<div class="label_select"><p class="edit_user_labels">'
$default_event_filter .= html_print_select(
$event_filter,
'default_event_filter',
$user_info['default_event_filter'],
($user_info['default_event_filter'] ?? 0),
'',
'',
__('None'),
@ -1661,14 +1646,12 @@ if ((bool) $config['admin_can_add_user'] === true) {
}
echo '</div>';
if ($new_user === true) {
html_print_input_hidden('json_profile', $json_profile);
}
html_print_input_hidden('json_profile', $json_profile);
echo '</form>';
// User Profile definition table. (Only where user is not creating).
if ($new_user === false && ((bool) check_acl($config['id_user'], 0, 'UM') === true)) {
if ((bool) check_acl($config['id_user'], 0, 'UM') === true) {
profile_print_profile_table($id, io_safe_output($json_profile), false, ($is_err === true));
}
@ -1720,7 +1703,7 @@ $delete_image = html_print_input_image(
true,
[
'onclick' => 'delete_profile(event, this)',
'class' => 'invert_filter',
'class' => 'invert_filter main_menu_icon',
]
);
@ -1891,7 +1874,7 @@ if (is_metaconsole() === false) {
profile_text = `<a href="index.php?sec2=godmode/users/configure_profile&id=${profile}">${profile_text}</a>`;
group_img = `<img id="img_group_${aux}" src="" data-title="${group_text}" data-use_title_for_force_title="1" class="invert_filter main_menu_icon bot forced_title" alt="${group_text}"/>`;
group_text = `<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=${group}">${group_img}${group_text}</a>`;
group_text = `<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=${group}">${group_img} ${group_text}</a>`;
$('#table_profiles tr:last').before(
`<tr>
@ -2258,4 +2241,4 @@ if (is_metaconsole() === false) {
/* ]]> */
</script>
</script>

View File

@ -374,7 +374,13 @@ if (users_is_admin() === true) {
);
}
$userManagementTable->data['show_tips_startup'][0] = html_print_checkbox_switch('show_tips_startup', 1, ($user_info['show_tips_startup'] === null) ? true : $user_info['show_tips_startup'], true);
$userManagementTable->data['show_tips_startup'][0] = html_print_checkbox_switch(
'show_tips_startup',
1,
(isset($user_info['show_tips_startup']) === false) ? true : $user_info['show_tips_startup'],
true
);
$userManagementTable->data['show_tips_startup'][1] = '<span>'.__('Show usage tips at startup').'</span>';
// Session time input.
@ -537,7 +543,7 @@ $userManagementTable->data['captions_autorefreshTime'][0] = __('Time for autoref
$userManagementTable->data['fields_autorefreshTime'][0] = html_print_select(
get_refresh_time_array(),
'time_autorefresh',
$user_info['time_autorefresh'],
($user_info['time_autorefresh'] ?? 0),
'',
'',
'',
@ -594,7 +600,7 @@ $userManagementTable->data['captions_blocksize_eventfilter'][1] = __('Event filt
$userManagementTable->data['fields_blocksize_eventfilter'][1] = html_print_select(
$event_filter,
'default_event_filter',
$user_info['default_event_filter'],
($user_info['default_event_filter'] ?? 0),
'',
'',
__('None'),
@ -700,7 +706,7 @@ $userManagementTable->data['fields_addSettings'][1] = html_print_div(
'allowed_ip_list',
5,
65,
$user_info['allowed_ip_list'],
($user_info['allowed_ip_list'] ?? ''),
(((bool) $view_mode === true) ? 'readonly="readonly"' : ''),
true
),
@ -720,7 +726,7 @@ $allowAllIpsContent[] = html_print_div(
'content' => html_print_checkbox_switch(
'allowed_ip_active',
0,
$user_info['allowed_ip_active'],
($user_info['allowed_ip_active'] ?? 0),
true
),
],
@ -736,13 +742,15 @@ $userManagementTable->data['fields_addSettings'][1] .= html_print_div(
true
);
// QR Code and API Token advice.
html_print_div(
[
'id' => 'api_qrcode_display',
'content' => $CodeQRTable.$apiTokenContent,
]
);
if (isset($CodeQRTable) === true || isset($apiTokenContent) === true) {
// QR Code and API Token advice.
html_print_div(
[
'id' => 'api_qrcode_display',
'content' => $CodeQRTable.$apiTokenContent,
]
);
}
html_print_table($userManagementTable);

View File

@ -712,7 +712,14 @@ function ui_print_group_icon($id_group, $return=false, $path='', $style='', $lin
$output = '';
$icon = ($id_group > 0) ? (string) db_get_value('icon', 'tgrupo', 'id_grupo', (int) $id_group) : 'unknown@groups.svg';
$icon = 'world@svg.svg';
if ($id_group > 0) {
$icon = db_get_value('icon', 'tgrupo', 'id_grupo', (int) $id_group);
if (empty($icon) === true) {
$icon = 'unknown@groups.svg';
}
}
$extension = pathinfo($icon, PATHINFO_EXTENSION);
if (empty($extension) === true) {
$icon .= '.png';