From c1e35a5d1761725f61c991f59695fd0bd9788594 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Fri, 28 Apr 2023 09:51:30 +0200 Subject: [PATCH 1/2] #10081 Add option homescreen in metaconsole again --- .../godmode/users/user_management.php | 68 +- pandora_console/operation/users/user_edit.php | 814 +++++++++--------- 2 files changed, 435 insertions(+), 447 deletions(-) diff --git a/pandora_console/godmode/users/user_management.php b/pandora_console/godmode/users/user_management.php index 45c54306ce..f950933629 100644 --- a/pandora_console/godmode/users/user_management.php +++ b/pandora_console/godmode/users/user_management.php @@ -608,41 +608,41 @@ $userManagementTable->data['fields_blocksize_eventfilter'][1] = html_print_selec false, false ); -if (is_metaconsole() === false) { - // Home screen table. - $homeScreenTable = new stdClass(); - $homeScreenTable->class = 'w100p full_section'; - $homeScreenTable->id = 'home_screen_table'; - $homeScreenTable->style = []; - $homeScreenTable->rowclass = []; - $homeScreenTable->data = []; - // Home screen. - $homeScreenTable->data['captions_homescreen'][0] = __('Home screen'); - $homeScreenTable->colspan['captions_homescreen'][0] = 2; - $homeScreenTable->rowclass['captions_homescreen'] = 'field_half_width'; - $homeScreenTable->rowclass['fields_homescreen'] = 'field_half_width flex'; - $homeScreenTable->data['fields_homescreen'][0] = html_print_select( - $homeScreenValues, - 'section', - io_safe_output($user_info['section']), - 'show_data_section();', - '', - -1, - true, - false, - false - ); - $homeScreenTable->data['fields_homescreen'][1] = html_print_div( - [ - 'class' => 'w100p', - 'content' => $customHomeScreenDataField, - ], - true - ); - $userManagementTable->rowclass['homescreen_table'] = 'w100p'; - $userManagementTable->data['homescreen_table'] = html_print_table($homeScreenTable, true); -} +// Home screen table. +$homeScreenTable = new stdClass(); +$homeScreenTable->class = 'w100p full_section'; +$homeScreenTable->id = 'home_screen_table'; +$homeScreenTable->style = []; +$homeScreenTable->rowclass = []; +$homeScreenTable->data = []; +// Home screen. +$homeScreenTable->data['captions_homescreen'][0] = __('Home screen'); +$homeScreenTable->colspan['captions_homescreen'][0] = 2; +$homeScreenTable->rowclass['captions_homescreen'] = 'field_half_width'; +$homeScreenTable->rowclass['fields_homescreen'] = 'field_half_width flex'; +$homeScreenTable->data['fields_homescreen'][0] = html_print_select( + $homeScreenValues, + 'section', + io_safe_output($user_info['section']), + 'show_data_section();', + '', + -1, + true, + false, + false +); +$homeScreenTable->data['fields_homescreen'][1] = html_print_div( + [ + 'class' => 'w100p', + 'content' => $customHomeScreenDataField, + ], + true +); + +$userManagementTable->rowclass['homescreen_table'] = 'w100p'; +$userManagementTable->data['homescreen_table'] = html_print_table($homeScreenTable, true); + if (is_metaconsole() === true && users_is_admin() === true) { $userManagementTable->rowclass['search_custom1_looknfeel'] = 'field_half_width'; diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index a6144d9de0..17aedf98ed 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -462,7 +462,7 @@ $usr_groups = (users_get_groups($config['id_user'], 'AR', $display_all_group)); $id_usr = $config['id_user']; $skin = ''; -if (!$meta) { + $home_screen = '

'.__('Home screen').ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 to show agent detail view'), true).'

'; $values = [ 'Default' => __('Default'), @@ -520,163 +520,151 @@ if (!$meta) { $skin .= skins_print_select($id_usr, 'skin', $user_info['id_skin'], '', __('None'), 0, true).'
'; } } -} else { - $home_screen = ''; - // User only can change skins if has more than one group. - if (function_exists('skins_print_select')) { - if (count($usr_groups) > 1) { - $skin = '

'.__('Theme').ui_print_help_tip( - __('This change will only apply to nodes'), - true - ).'

'; - $skin .= skins_print_select($id_usr, 'skin', $user_info['id_skin'], '', __('None'), 0, true).'
'; + + + $timezone = '

'.__('Timezone').ui_print_help_tip(__('The timezone must be that of the associated server.'), true).'

'; + $timezone .= html_print_timezone_select('timezone', $user_info['timezone']).'
'; + + // Double auth. + $double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']); + + if ((bool) $config['double_auth_enabled'] === true) { + $double_authentication = '

'.__('Double authentication').'

'; + if (($config['2FA_all_users'] == '' && !$double_auth_enabled) + || ($config['2FA_all_users'] != '' && !$double_auth_enabled) + || ($config['double_auth_enabled'] == '' && $double_auth_enabled) + || check_acl($config['id_user'], 0, 'PM') + ) { + $double_authentication .= html_print_checkbox_switch('double_auth', 1, $double_auth_enabled, true); + } + + // Dialog. + $double_authentication .= ''; + } + + if ($double_auth_enabled && $config['double_auth_enabled']) { + $double_authentication .= html_print_button( + __('Show information'), + 'show_info', + false, + 'show_double_auth_info();', + [ 'icon' => 'camera' ], + '', + true + ); + } + + if (isset($double_authentication) === true) { + $double_authentication .= '
'; + } + + if ((bool) check_acl($config['id_user'], 0, 'ER') === true) { + $event_filter = '

'.__('Event filter').'

'; + $user_groups = implode(',', array_keys((users_get_groups($config['id_user'], 'AR', true)))); + $event_filter .= html_print_select_from_sql( + 'SELECT id_filter, id_name FROM tevent_filter WHERE id_group_filter IN ('.$user_groups.')', + 'event_filter', + $user_info['default_event_filter'], + '', + __('None'), + null, + true + ).'
'; + } + + $autorefresh_list_out = []; + if (is_metaconsole() === false || is_centralized() === true) { + $autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail'; + $autorefresh_list_out['operation/agentes/alerts_status'] = 'Alert detail'; + $autorefresh_list_out['enterprise/operation/cluster/cluster'] = 'Cluster view'; + $autorefresh_list_out['operation/gis_maps/render_view'] = 'Gis Map'; + $autorefresh_list_out['operation/reporting/graph_viewer'] = 'Graph Viewer'; + $autorefresh_list_out['operation/snmpconsole/snmp_view'] = 'SNMP console'; + + if (enterprise_installed()) { + $autorefresh_list_out['general/sap_view'] = 'SAP view'; } } -} -$timezone = '

'.__('Timezone').ui_print_help_tip(__('The timezone must be that of the associated server.'), true).'

'; -$timezone .= html_print_timezone_select('timezone', $user_info['timezone']).'
'; + $autorefresh_list_out['operation/agentes/tactical'] = 'Tactical view'; + $autorefresh_list_out['operation/agentes/group_view'] = 'Group view'; + $autorefresh_list_out['operation/agentes/status_monitor'] = 'Monitor detail'; + $autorefresh_list_out['enterprise/operation/services/services'] = 'Services'; + $autorefresh_list_out['operation/dashboard/dashboard'] = 'Dashboard'; -// Double auth. -$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']); + $autorefresh_list_out['operation/agentes/pandora_networkmap'] = 'Network map'; + $autorefresh_list_out['operation/visual_console/render_view'] = 'Visual console'; + $autorefresh_list_out['operation/events/events'] = 'Events'; -if ((bool) $config['double_auth_enabled'] === true) { - $double_authentication = '

'.__('Double authentication').'

'; - if (($config['2FA_all_users'] == '' && !$double_auth_enabled) - || ($config['2FA_all_users'] != '' && !$double_auth_enabled) - || ($config['double_auth_enabled'] == '' && $double_auth_enabled) - || check_acl($config['id_user'], 0, 'PM') - ) { - $double_authentication .= html_print_checkbox_switch('double_auth', 1, $double_auth_enabled, true); + + if (!isset($autorefresh_list)) { + $select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '".$config['id_user']."'"); + $autorefresh_list = json_decode($select[0]['autorefresh_white_list']); + if ($autorefresh_list === null) { + $autorefresh_list[0] = __('None'); + } else { + $aux = []; + $count_autorefresh_list = count($autorefresh_list); + for ($i = 0; $i < $count_autorefresh_list; $i++) { + $aux[$autorefresh_list[$i]] = $autorefresh_list_out[$autorefresh_list[$i]]; + unset($autorefresh_list_out[$autorefresh_list[$i]]); + $autorefresh_list[$i] = $aux; + } + + $autorefresh_list = $aux; + } + } else { + if (is_array($autorefresh_list) === false || empty($autorefresh_list[0]) === true || $autorefresh_list[0] === '0') { + $autorefresh_list = []; + $autorefresh_list[0] = __('None'); + } else { + $aux = []; + $count_autorefresh_list = count($autorefresh_list); + for ($i = 0; $i < $count_autorefresh_list; $i++) { + $aux[$autorefresh_list[$i]] = $autorefresh_list_out[$autorefresh_list[$i]]; + unset($autorefresh_list_out[$autorefresh_list[$i]]); + $autorefresh_list[$i] = $aux; + } + + $autorefresh_list = $aux; + } } - // Dialog. - $double_authentication .= ''; -} - -if ($double_auth_enabled && $config['double_auth_enabled']) { - $double_authentication .= html_print_button( - __('Show information'), - 'show_info', + $autorefresh_show = '

'._('Autorefresh').ui_print_help_tip( + __('This will activate autorefresh in selected pages'), + true + ).'

'; + $select_out = html_print_select( + $autorefresh_list_out, + 'autorefresh_list_out[]', + '', + '', + '', + '', + true, + true, + true, + '', false, - 'show_double_auth_info();', - [ 'icon' => 'camera' ], - '', - true + 'width:100%' ); -} - -if (isset($double_authentication) === true) { - $double_authentication .= '
'; -} - -if ((bool) check_acl($config['id_user'], 0, 'ER') === true) { - $event_filter = '

'.__('Event filter').'

'; - $user_groups = implode(',', array_keys((users_get_groups($config['id_user'], 'AR', true)))); - $event_filter .= html_print_select_from_sql( - 'SELECT id_filter, id_name FROM tevent_filter WHERE id_group_filter IN ('.$user_groups.')', - 'event_filter', - $user_info['default_event_filter'], + $arrows = ' '; + $select_in = html_print_select( + $autorefresh_list, + 'autorefresh_list[]', '', - __('None'), - null, - true - ).'
'; -} + '', + '', + '', + true, + true, + true, + '', + false, + 'width:100%' + ); -$autorefresh_list_out = []; -if (is_metaconsole() === false || is_centralized() === true) { - $autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail'; - $autorefresh_list_out['operation/agentes/alerts_status'] = 'Alert detail'; - $autorefresh_list_out['enterprise/operation/cluster/cluster'] = 'Cluster view'; - $autorefresh_list_out['operation/gis_maps/render_view'] = 'Gis Map'; - $autorefresh_list_out['operation/reporting/graph_viewer'] = 'Graph Viewer'; - $autorefresh_list_out['operation/snmpconsole/snmp_view'] = 'SNMP console'; - - if (enterprise_installed()) { - $autorefresh_list_out['general/sap_view'] = 'SAP view'; - } -} - -$autorefresh_list_out['operation/agentes/tactical'] = 'Tactical view'; -$autorefresh_list_out['operation/agentes/group_view'] = 'Group view'; -$autorefresh_list_out['operation/agentes/status_monitor'] = 'Monitor detail'; -$autorefresh_list_out['enterprise/operation/services/services'] = 'Services'; -$autorefresh_list_out['operation/dashboard/dashboard'] = 'Dashboard'; - -$autorefresh_list_out['operation/agentes/pandora_networkmap'] = 'Network map'; -$autorefresh_list_out['operation/visual_console/render_view'] = 'Visual console'; -$autorefresh_list_out['operation/events/events'] = 'Events'; - - -if (!isset($autorefresh_list)) { - $select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '".$config['id_user']."'"); - $autorefresh_list = json_decode($select[0]['autorefresh_white_list']); - if ($autorefresh_list === null) { - $autorefresh_list[0] = __('None'); - } else { - $aux = []; - $count_autorefresh_list = count($autorefresh_list); - for ($i = 0; $i < $count_autorefresh_list; $i++) { - $aux[$autorefresh_list[$i]] = $autorefresh_list_out[$autorefresh_list[$i]]; - unset($autorefresh_list_out[$autorefresh_list[$i]]); - $autorefresh_list[$i] = $aux; - } - - $autorefresh_list = $aux; - } -} else { - if (is_array($autorefresh_list) === false || empty($autorefresh_list[0]) === true || $autorefresh_list[0] === '0') { - $autorefresh_list = []; - $autorefresh_list[0] = __('None'); - } else { - $aux = []; - $count_autorefresh_list = count($autorefresh_list); - for ($i = 0; $i < $count_autorefresh_list; $i++) { - $aux[$autorefresh_list[$i]] = $autorefresh_list_out[$autorefresh_list[$i]]; - unset($autorefresh_list_out[$autorefresh_list[$i]]); - $autorefresh_list[$i] = $aux; - } - - $autorefresh_list = $aux; - } -} - -$autorefresh_show = '

'._('Autorefresh').ui_print_help_tip( - __('This will activate autorefresh in selected pages'), - true -).'

'; -$select_out = html_print_select( - $autorefresh_list_out, - 'autorefresh_list_out[]', - '', - '', - '', - '', - true, - true, - true, - '', - false, - 'width:100%' -); -$arrows = ' '; -$select_in = html_print_select( - $autorefresh_list, - 'autorefresh_list[]', - '', - '', - '', - '', - true, - true, - true, - '', - false, - 'width:100%' -); - -$table_ichanges = '
+ $table_ichanges = '

'.__('Full list of pages').':

'.$select_out.'
@@ -707,26 +695,26 @@ $table_ichanges = '
'; -$autorefresh_show .= $table_ichanges; + $autorefresh_show .= $table_ichanges; -// Time autorefresh. -$times = get_refresh_time_array(); -$time_autorefresh = '

'.__('Time autorefresh'); -$time_autorefresh .= ui_print_help_tip( - __('Interval of autorefresh of the elements, by default they are 30 seconds, needing to enable the autorefresh first'), - true -).'

'; -$time_autorefresh .= html_print_select( - $times, - 'time_autorefresh', - $user_info['time_autorefresh'], - '', - '', - '', - true, - false, - false -).'
'; + // Time autorefresh. + $times = get_refresh_time_array(); + $time_autorefresh = '

'.__('Time autorefresh'); + $time_autorefresh .= ui_print_help_tip( + __('Interval of autorefresh of the elements, by default they are 30 seconds, needing to enable the autorefresh first'), + true + ).'

'; + $time_autorefresh .= html_print_select( + $times, + 'time_autorefresh', + $user_info['time_autorefresh'], + '', + '', + '', + true, + false, + false + ).'
'; @@ -740,62 +728,62 @@ $time_autorefresh .= html_print_select( -$comments = '

'.__('Comments').':

'; -$comments .= html_print_textarea( - 'comments', - 2, - 60, - $user_info['comments'], - (($view_mode) ? 'readonly="readonly"' : ''), - true -); -$comments .= html_print_input_hidden('quick_language_change', 1, true); + $comments = '

'.__('Comments').':

'; + $comments .= html_print_textarea( + 'comments', + 2, + 60, + $user_info['comments'], + (($view_mode) ? 'readonly="readonly"' : ''), + true + ); + $comments .= html_print_input_hidden('quick_language_change', 1, true); -$allowedIP = '

'; -$allowedIP .= __('Login allowed IP list').' '; -$allowedIP .= ui_print_help_tip(__('Add the source IPs that will allow console access. Each IP must be separated only by comma. * allows all.'), true).' '; -$allowedIP .= html_print_checkbox_switch( - 'allowed_ip_active', - 0, - $user_info['allowed_ip_active'], - true -); -$allowedIP .= '

'; -$allowedIP .= html_print_textarea( - 'allowed_ip_list', - 2, - 65, - $user_info['allowed_ip_list'], - ($view_mode ? 'readonly="readonly"' : ''), - true -); + $allowedIP = '

'; + $allowedIP .= __('Login allowed IP list').' '; + $allowedIP .= ui_print_help_tip(__('Add the source IPs that will allow console access. Each IP must be separated only by comma. * allows all.'), true).' '; + $allowedIP .= html_print_checkbox_switch( + 'allowed_ip_active', + 0, + $user_info['allowed_ip_active'], + true + ); + $allowedIP .= '

'; + $allowedIP .= html_print_textarea( + 'allowed_ip_list', + 2, + 65, + $user_info['allowed_ip_list'], + ($view_mode ? 'readonly="readonly"' : ''), + true + ); -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'; + 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 .= ''; + } } - $area_data_timezone_polys .= ''; - foreach ($tz['polys'] as $coords) { - $area_data_timezone_polys .= ''; + if (is_metaconsole() === true) { + echo '
'; + } else { + echo ''; } - $area_data_timezone_rects .= ''; - foreach ($tz['rects'] as $coords) { - $area_data_timezone_rects .= ''; - } -} - -if (is_metaconsole() === true) { - echo ''; -} else { - echo ''; -} - html_print_input_hidden('id', $id, false, false, false, 'id'); echo '
@@ -812,13 +800,13 @@ if (is_metaconsole() === true) { -if (is_metaconsole() === false) { - echo '
+ if (is_metaconsole() === false) { + echo '
'.$area_data_timezone_polys.$area_data_timezone_rects.'
'; -} + } echo '
@@ -831,216 +819,216 @@ if (is_metaconsole() === false) {
'; -if ($config['ehorus_enabled'] && $config['ehorus_user_level_conf']) { - // EHorus user remote login. - $table_remote = new StdClass(); - $table_remote->data = []; - $table_remote->width = '100%'; - $table_remote->id = 'ehorus-remote-setup'; - $table_remote->class = 'white_box'; - $table_remote->size['name'] = '30%'; - $table_remote->style['name'] = 'font-weight: bold'; + if ($config['ehorus_enabled'] && $config['ehorus_user_level_conf']) { + // EHorus user remote login. + $table_remote = new StdClass(); + $table_remote->data = []; + $table_remote->width = '100%'; + $table_remote->id = 'ehorus-remote-setup'; + $table_remote->class = 'white_box'; + $table_remote->size['name'] = '30%'; + $table_remote->style['name'] = 'font-weight: bold'; - // Title. - $row = []; - $row['control'] = '

'.__('eHorus user configuration').':

'; - $table_remote->data['ehorus_user_level_conf'] = $row; + // Title. + $row = []; + $row['control'] = '

'.__('eHorus user configuration').':

'; + $table_remote->data['ehorus_user_level_conf'] = $row; - // Enable/disable eHorus for this user. - $row = []; - $row['name'] = __('eHorus user acces enabled'); - $row['control'] = html_print_checkbox_switch('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true); - $table_remote->data['ehorus_user_level_enabled'] = $row; + // Enable/disable eHorus for this user. + $row = []; + $row['name'] = __('eHorus user acces enabled'); + $row['control'] = html_print_checkbox_switch('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true); + $table_remote->data['ehorus_user_level_enabled'] = $row; - // User. - $row = []; - $row['name'] = __('User'); - $row['control'] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 30, 100, true); - $table_remote->data['ehorus_user_level_user'] = $row; + // User. + $row = []; + $row['name'] = __('User'); + $row['control'] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 30, 100, true); + $table_remote->data['ehorus_user_level_user'] = $row; - // Pass. - $row = []; - $row['name'] = __('Password'); - $row['control'] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 30, 100, true); - $table_remote->data['ehorus_user_level_pass'] = $row; + // Pass. + $row = []; + $row['name'] = __('Password'); + $row['control'] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 30, 100, true); + $table_remote->data['ehorus_user_level_pass'] = $row; - // Test. - $ehorus_port = db_get_value('value', 'tconfig', 'token', 'ehorus_port'); - $ehorus_host = db_get_value('value', 'tconfig', 'token', 'ehorus_hostname'); + // Test. + $ehorus_port = db_get_value('value', 'tconfig', 'token', 'ehorus_port'); + $ehorus_host = db_get_value('value', 'tconfig', 'token', 'ehorus_hostname'); - $row = []; - $row['name'] = __('Test'); - $row['control'] = html_print_button( - __('Start'), - 'test-ehorus', - false, - 'ehorus_connection_test("'.$ehorus_host.'",'.$ehorus_port.')', - [ 'icon' => 'next' ], - true - ); - $row['control'] .= ' '; - $row['control'] .= ' '; - $row['control'] .= ' '; - $row['control'] .= ''; - $table_remote->data['ehorus_test'] = $row; - - echo '
'; - html_print_table($table_remote); - echo '
'; -} - -if ($config['integria_enabled'] && $config['integria_user_level_conf']) { - // Integria IMS user remote login. - $table_remote = new StdClass(); - $table_remote->data = []; - $table_remote->width = '100%'; - $table_remote->id = 'integria-remote-setup'; - $table_remote->class = 'white_box'; - $table_remote->size['name'] = '30%'; - $table_remote->style['name'] = 'font-weight: bold'; - - // Integria IMS user level authentication. - // Title. - $row = []; - $row['control'] = '

'.__('Integria user configuration').':

'; - $table_remote->data['integria_user_level_conf'] = $row; - - // Integria IMS user. - $row = []; - $row['name'] = __('User'); - $row['control'] = html_print_input_text('integria_user_level_user', $user_info['integria_user_level_user'], '', 30, 100, true); - $table_remote->data['integria_user_level_user'] = $row; - - // Integria IMS pass. - $row = []; - $row['name'] = __('Password'); - $row['control'] = html_print_input_password('integria_user_level_pass', io_output_password($user_info['integria_user_level_pass']), '', 30, 100, true); - $table_remote->data['integria_user_level_pass'] = $row; - - // Test. - $integria_host = db_get_value('value', 'tconfig', 'token', 'integria_hostname'); - $integria_api_pass = db_get_value('value', 'tconfig', 'token', 'integria_api_pass'); - - $row = []; - $row['name'] = __('Test'); - $row['control'] = html_print_button( - __('Start'), - 'test-integria', - false, - 'integria_connection_test("'.$integria_host.'",'.$integria_api_pass.')', - [ 'icon' => 'next' ], - true - ); - $row['control'] .= ' '; - $row['control'] .= ' '; - $row['control'] .= ' '; - $row['control'] .= ''; - $table_remote->data['integria_test'] = $row; - - echo '
'; - html_print_table($table_remote); - echo '
'; -} - - -if ($is_management_allowed === true) { - if ((bool) $config['user_can_update_info'] === false) { - $outputButton = ''.__('You can not change your user info under the current authentication scheme').''; - } else { - $outputButton = html_print_submit_button( - __('Update'), - 'uptbutton', - $view_mode, - [ 'icon' => 'update' ], + $row = []; + $row['name'] = __('Test'); + $row['control'] = html_print_button( + __('Start'), + 'test-ehorus', + false, + 'ehorus_connection_test("'.$ehorus_host.'",'.$ehorus_port.')', + [ 'icon' => 'next' ], true ); - $outputButton .= html_print_csrf_hidden(true); + $row['control'] .= ' '; + $row['control'] .= ' '; + $row['control'] .= ' '; + $row['control'] .= ''; + $table_remote->data['ehorus_test'] = $row; + + echo '
'; + html_print_table($table_remote); + echo '
'; } - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => $outputButton, - ] - ); -} + if ($config['integria_enabled'] && $config['integria_user_level_conf']) { + // Integria IMS user remote login. + $table_remote = new StdClass(); + $table_remote->data = []; + $table_remote->width = '100%'; + $table_remote->id = 'integria-remote-setup'; + $table_remote->class = 'white_box'; + $table_remote->size['name'] = '30%'; + $table_remote->style['name'] = 'font-weight: bold'; -echo ''; + // Integria IMS user level authentication. + // Title. + $row = []; + $row['control'] = '

'.__('Integria user configuration').':

'; + $table_remote->data['integria_user_level_conf'] = $row; -echo '
'; -if (is_metaconsole() === false) { - echo '

'.__('Profiles/Groups assigned to this user').'

'; -} + // Integria IMS user. + $row = []; + $row['name'] = __('User'); + $row['control'] = html_print_input_text('integria_user_level_user', $user_info['integria_user_level_user'], '', 30, 100, true); + $table_remote->data['integria_user_level_user'] = $row; -$table = new stdClass(); -$table->width = '100%'; -$table->class = 'info_table'; -if (is_metaconsole() === true) { + // Integria IMS pass. + $row = []; + $row['name'] = __('Password'); + $row['control'] = html_print_input_password('integria_user_level_pass', io_output_password($user_info['integria_user_level_pass']), '', 30, 100, true); + $table_remote->data['integria_user_level_pass'] = $row; + + // Test. + $integria_host = db_get_value('value', 'tconfig', 'token', 'integria_hostname'); + $integria_api_pass = db_get_value('value', 'tconfig', 'token', 'integria_api_pass'); + + $row = []; + $row['name'] = __('Test'); + $row['control'] = html_print_button( + __('Start'), + 'test-integria', + false, + 'integria_connection_test("'.$integria_host.'",'.$integria_api_pass.')', + [ 'icon' => 'next' ], + true + ); + $row['control'] .= ' '; + $row['control'] .= ' '; + $row['control'] .= ' '; + $row['control'] .= ''; + $table_remote->data['integria_test'] = $row; + + echo '
'; + html_print_table($table_remote); + echo '
'; + } + + + if ($is_management_allowed === true) { + if ((bool) $config['user_can_update_info'] === false) { + $outputButton = ''.__('You can not change your user info under the current authentication scheme').''; + } else { + $outputButton = html_print_submit_button( + __('Update'), + 'uptbutton', + $view_mode, + [ 'icon' => 'update' ], + true + ); + $outputButton .= html_print_csrf_hidden(true); + } + + html_print_div( + [ + 'class' => 'action-buttons', + 'content' => $outputButton, + ] + ); + } + + echo ''; + + echo '
'; + if (is_metaconsole() === false) { + echo '

'.__('Profiles/Groups assigned to this user').'

'; + } + + $table = new stdClass(); $table->width = '100%'; - $table->class = 'databox data'; - $table->title = __('Profiles/Groups assigned to this user'); - $table->head_colspan[0] = 0; - $table->headstyle[] = 'background-color: #82B93C'; - $table->headstyle[] = 'background-color: #82B93C'; - $table->headstyle[] = 'background-color: #82B93C'; -} - -$table->data = []; -$table->head = []; -$table->align = []; -$table->style = []; - -if (is_metaconsole() === false) { - $table->style[0] = 'font-weight: bold'; - $table->style[1] = 'font-weight: bold'; -} - -$table->head[0] = __('Profile name'); -$table->head[1] = __('Group'); -$table->head[2] = __('Tags'); -$table->align = []; -$table->align[1] = 'left'; - -$table->data = []; - -$result = db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $id); -if ($result === false) { - $result = []; -} - -foreach ($result as $profile) { - $data[0] = ''.profile_get_name($profile['id_perfil']).''; - if ($config['show_group_name']) { - $data[1] = ui_print_group_icon( - $profile['id_grupo'], - true - ).' '; - } else { - $data[1] = ui_print_group_icon( - $profile['id_grupo'], - true - ).' '.ui_print_truncate_text(groups_get_name($profile['id_grupo'], true), GENERIC_SIZE_TEXT).''; + $table->class = 'info_table'; + if (is_metaconsole() === true) { + $table->width = '100%'; + $table->class = 'databox data'; + $table->title = __('Profiles/Groups assigned to this user'); + $table->head_colspan[0] = 0; + $table->headstyle[] = 'background-color: #82B93C'; + $table->headstyle[] = 'background-color: #82B93C'; + $table->headstyle[] = 'background-color: #82B93C'; } - $tags_ids = explode(',', $profile['tags']); - $tags = tags_get_tags($tags_ids); + $table->data = []; + $table->head = []; + $table->align = []; + $table->style = []; - $data[2] = tags_get_tags_formatted($tags); + if (is_metaconsole() === false) { + $table->style[0] = 'font-weight: bold'; + $table->style[1] = 'font-weight: bold'; + } - array_push($table->data, $data); -} + $table->head[0] = __('Profile name'); + $table->head[1] = __('Group'); + $table->head[2] = __('Tags'); + $table->align = []; + $table->align[1] = 'left'; -if (!empty($table->data)) { - html_print_table($table); -} else { - ui_print_info_message(['no_close' => true, 'message' => __('This user doesn\'t have any assigned profile/group.') ]); -} + $table->data = []; -// Close edit_user_profiles. -echo '
'; + $result = db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $id); + if ($result === false) { + $result = []; + } -if (is_metaconsole() === false) { - ?> + foreach ($result as $profile) { + $data[0] = ''.profile_get_name($profile['id_perfil']).''; + if ($config['show_group_name']) { + $data[1] = ui_print_group_icon( + $profile['id_grupo'], + true + ).' '; + } else { + $data[1] = ui_print_group_icon( + $profile['id_grupo'], + true + ).' '.ui_print_truncate_text(groups_get_name($profile['id_grupo'], true), GENERIC_SIZE_TEXT).''; + } + + $tags_ids = explode(',', $profile['tags']); + $tags = tags_get_tags($tags_ids); + + $data[2] = tags_get_tags_formatted($tags); + + array_push($table->data, $data); + } + + if (!empty($table->data)) { + html_print_table($table); + } else { + ui_print_info_message(['no_close' => true, 'message' => __('This user doesn\'t have any assigned profile/group.') ]); + } + + // Close edit_user_profiles. + echo '
'; + + if (is_metaconsole() === false) { + ?>