Merge branch 'ent-10081-14644-meta-homescreen-no-aparece-en-edit-my-user-pero-si-en-configuracion-de-usuario' into 'develop'

Ent 10081 14644 meta homescreen no aparece en edit my user pero si en configuracion de usuario

See merge request artica/pandorafms!5809
This commit is contained in:
Daniel Rodriguez 2023-05-16 09:49:59 +00:00
commit be807d572d
3 changed files with 451 additions and 447 deletions

View File

@ -54,6 +54,18 @@ if ($enterprise_include === true) {
enterprise_include_once('meta/include/functions_users_meta.php');
}
$homeScreenValues = [
HOME_SCREEN_DEFAULT => __('Default'),
HOME_SCREEN_VISUAL_CONSOLE => __('Visual console'),
HOME_SCREEN_EVENT_LIST => __('Event list'),
HOME_SCREEN_GROUP_VIEW => __('Group view'),
HOME_SCREEN_TACTICAL_VIEW => __('Tactical view'),
HOME_SCREEN_ALERT_DETAIL => __('Alert detail'),
HOME_SCREEN_EXTERNAL_LINK => __('External link'),
HOME_SCREEN_OTHER => __('Other'),
HOME_SCREEN_DASHBOARD => __('Dashboard'),
];
// 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', ''));
@ -414,6 +426,8 @@ if ($create_user === true) {
$values['data_section'] = get_parameter('data_section');
}
$values['section'] = $homeScreenValues[$values['section']];
if (enterprise_installed() === true) {
$values['force_change_pass'] = 1;
$values['last_pass_change'] = date('Y/m/d H:i:s', get_system_time());
@ -696,6 +710,8 @@ if ($update_user) {
$values['data_section'] = get_parameter('data_section');
}
$values['section'] = $homeScreenValues[$values['section']];
if (enterprise_installed() === true && is_metaconsole() === true) {
$values['metaconsole_access'] = get_parameter('metaconsole_access');
$values['metaconsole_agents_manager'] = get_parameter('metaconsole_agents_manager', '0');

View File

@ -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(
// 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']),
array_search($user_info['section'], $homeScreenValues),
'show_data_section();',
'',
-1,
true,
false,
false
);
$homeScreenTable->data['fields_homescreen'][1] = html_print_div(
);
$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);
$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';

View File

@ -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 = '<div class="label_select"><p class="edit_user_labels">'.__('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).'</p>';
$values = [
'Default' => __('Default'),
@ -520,27 +520,15 @@ if (!$meta) {
$skin .= skins_print_select($id_usr, 'skin', $user_info['id_skin'], '', __('None'), 0, true).'</div>';
}
}
} 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 = '<div class="label_select"><p class="edit_user_labels">'.__('Theme').ui_print_help_tip(
__('This change will only apply to nodes'),
true
).'</p>';
$skin .= skins_print_select($id_usr, 'skin', $user_info['id_skin'], '', __('None'), 0, true).'</div>';
}
}
}
$timezone = '<div class="label_select"><p class="edit_user_labels">'.__('Timezone').ui_print_help_tip(__('The timezone must be that of the associated server.'), true).'</p>';
$timezone .= html_print_timezone_select('timezone', $user_info['timezone']).'</div>';
// Double auth.
$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']);
$timezone = '<div class="label_select"><p class="edit_user_labels">'.__('Timezone').ui_print_help_tip(__('The timezone must be that of the associated server.'), true).'</p>';
$timezone .= html_print_timezone_select('timezone', $user_info['timezone']).'</div>';
if ((bool) $config['double_auth_enabled'] === true) {
// 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 = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Double authentication').'</p>';
if (($config['2FA_all_users'] == '' && !$double_auth_enabled)
|| ($config['2FA_all_users'] != '' && !$double_auth_enabled)
@ -552,9 +540,9 @@ if ((bool) $config['double_auth_enabled'] === true) {
// Dialog.
$double_authentication .= '<div id="dialog-double_auth"class="invisible"><div id="dialog-double_auth-container"></div></div>';
}
}
if ($double_auth_enabled && $config['double_auth_enabled']) {
if ($double_auth_enabled && $config['double_auth_enabled']) {
$double_authentication .= html_print_button(
__('Show information'),
'show_info',
@ -564,13 +552,13 @@ if ($double_auth_enabled && $config['double_auth_enabled']) {
'',
true
);
}
}
if (isset($double_authentication) === true) {
if (isset($double_authentication) === true) {
$double_authentication .= '</div>';
}
}
if ((bool) check_acl($config['id_user'], 0, 'ER') === true) {
if ((bool) check_acl($config['id_user'], 0, 'ER') === true) {
$event_filter = '<div class="label_select"><p class="edit_user_labels">'.__('Event filter').'</p>';
$user_groups = implode(',', array_keys((users_get_groups($config['id_user'], 'AR', true))));
$event_filter .= html_print_select_from_sql(
@ -582,10 +570,10 @@ if ((bool) check_acl($config['id_user'], 0, 'ER') === true) {
null,
true
).'</div>';
}
}
$autorefresh_list_out = [];
if (is_metaconsole() === false || is_centralized() === 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';
@ -596,20 +584,20 @@ if (is_metaconsole() === false || is_centralized() === true) {
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/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';
$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)) {
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) {
@ -625,7 +613,7 @@ if (!isset($autorefresh_list)) {
$autorefresh_list = $aux;
}
} else {
} else {
if (is_array($autorefresh_list) === false || empty($autorefresh_list[0]) === true || $autorefresh_list[0] === '0') {
$autorefresh_list = [];
$autorefresh_list[0] = __('None');
@ -640,13 +628,13 @@ if (!isset($autorefresh_list)) {
$autorefresh_list = $aux;
}
}
}
$autorefresh_show = '<p class="edit_user_labels">'._('Autorefresh').ui_print_help_tip(
$autorefresh_show = '<p class="edit_user_labels">'._('Autorefresh').ui_print_help_tip(
__('This will activate autorefresh in selected pages'),
true
).'</p>';
$select_out = html_print_select(
).'</p>';
$select_out = html_print_select(
$autorefresh_list_out,
'autorefresh_list_out[]',
'',
@ -659,9 +647,9 @@ $select_out = html_print_select(
'',
false,
'width:100%'
);
$arrows = ' ';
$select_in = html_print_select(
);
$arrows = ' ';
$select_in = html_print_select(
$autorefresh_list,
'autorefresh_list[]',
'',
@ -674,9 +662,9 @@ $select_in = html_print_select(
'',
false,
'width:100%'
);
);
$table_ichanges = '<div class="autorefresh_select">
$table_ichanges = '<div class="autorefresh_select">
<div class="autorefresh_select_list_out">
<p class="autorefresh_select_text">'.__('Full list of pages').': </p>
<div>'.$select_out.'</div>
@ -707,16 +695,16 @@ $table_ichanges = '<div class="autorefresh_select">
</div>
</div>';
$autorefresh_show .= $table_ichanges;
$autorefresh_show .= $table_ichanges;
// Time autorefresh.
$times = get_refresh_time_array();
$time_autorefresh = '<div class="label_select"><p class="edit_user_labels">'.__('Time autorefresh');
$time_autorefresh .= ui_print_help_tip(
// Time autorefresh.
$times = get_refresh_time_array();
$time_autorefresh = '<div class="label_select"><p class="edit_user_labels">'.__('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
).'</p>';
$time_autorefresh .= html_print_select(
).'</p>';
$time_autorefresh .= html_print_select(
$times,
'time_autorefresh',
$user_info['time_autorefresh'],
@ -726,7 +714,7 @@ $time_autorefresh .= html_print_select(
true,
false,
false
).'</div>';
).'</div>';
@ -740,39 +728,39 @@ $time_autorefresh .= html_print_select(
$comments = '<p class="edit_user_labels">'.__('Comments').': </p>';
$comments .= html_print_textarea(
$comments = '<p class="edit_user_labels">'.__('Comments').': </p>';
$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 .= html_print_input_hidden('quick_language_change', 1, true);
$allowedIP = '<p class="edit_user_labels">';
$allowedIP .= __('Login allowed IP list').'&nbsp;';
$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).'&nbsp;';
$allowedIP .= html_print_checkbox_switch(
$allowedIP = '<p class="edit_user_labels">';
$allowedIP .= __('Login allowed IP list').'&nbsp;';
$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).'&nbsp;';
$allowedIP .= html_print_checkbox_switch(
'allowed_ip_active',
0,
$user_info['allowed_ip_active'],
true
);
$allowedIP .= '</p>';
$allowedIP .= html_print_textarea(
);
$allowedIP .= '</p>';
$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) {
foreach ($timezones as $timezone_name => $tz) {
if ($timezone_name == 'America/Montreal') {
$timezone_name = 'America/Toronto';
} else if ($timezone_name == 'Asia/Chongqing') {
@ -788,13 +776,13 @@ foreach ($timezones as $timezone_name => $tz) {
foreach ($tz['rects'] as $coords) {
$area_data_timezone_rects .= '<area data-timezone="'.$timezone_name.'" data-country="'.$tz['country'].'" data-pin="'.implode(',', $tz['pin']).'" data-offset="'.$tz['offset'].'" shape="rect" coords="'.implode(',', $coords).'" />';
}
}
}
if (is_metaconsole() === true) {
if (is_metaconsole() === true) {
echo '<form id="user_profile_form" name="user_mod" method="post" action="'.ui_get_full_url('index.php?sec=advanced&sec2=advanced/users_setup').'&amp;tab=user_edit&amp;modified=1&amp;pure='.$config['pure'].'">';
} else {
} else {
echo '<form id="user_profile_form" name="user_mod" method="post" action="'.ui_get_full_url('index.php?sec=workspace&sec2=operation/users/user_edit').'&amp;modified=1&amp;pure='.$config['pure'].'">';
}
}
html_print_input_hidden('id', $id, false, false, false, 'id');
@ -812,13 +800,13 @@ if (is_metaconsole() === true) {
if (is_metaconsole() === false) {
if (is_metaconsole() === false) {
echo '<div id="timezone-picker">
<img id="timezone-image" src="'.$local_file.'" width="'.$map_width.'" height="'.$map_height.'" usemap="#timezone-map" />
<img class="timezone-pin pdd_t_4px" src="include/javascript/timezonepicker/images/pin.png" />
<map name="timezone-map" id="timezone-map">'.$area_data_timezone_polys.$area_data_timezone_rects.'</map>
</div>';
}
}
echo '</div>
</div>
@ -831,7 +819,7 @@ if (is_metaconsole() === false) {
</div>
</div>';
if ($config['ehorus_enabled'] && $config['ehorus_user_level_conf']) {
if ($config['ehorus_enabled'] && $config['ehorus_user_level_conf']) {
// EHorus user remote login.
$table_remote = new StdClass();
$table_remote->data = [];
@ -887,9 +875,9 @@ if ($config['ehorus_enabled'] && $config['ehorus_user_level_conf']) {
echo '<div class="ehorus_user_conf user_edit_fourth_row">';
html_print_table($table_remote);
echo '</div>';
}
}
if ($config['integria_enabled'] && $config['integria_user_level_conf']) {
if ($config['integria_enabled'] && $config['integria_user_level_conf']) {
// Integria IMS user remote login.
$table_remote = new StdClass();
$table_remote->data = [];
@ -940,10 +928,10 @@ if ($config['integria_enabled'] && $config['integria_user_level_conf']) {
echo '<div class="integria_user_conf">';
html_print_table($table_remote);
echo '</div>';
}
}
if ($is_management_allowed === true) {
if ($is_management_allowed === true) {
if ((bool) $config['user_can_update_info'] === false) {
$outputButton = '<i>'.__('You can not change your user info under the current authentication scheme').'</i>';
} else {
@ -963,19 +951,19 @@ if ($is_management_allowed === true) {
'content' => $outputButton,
]
);
}
}
echo '</form>';
echo '</form>';
echo '<div id="edit_user_profiles" class="white_box">';
if (is_metaconsole() === false) {
echo '<div id="edit_user_profiles" class="white_box">';
if (is_metaconsole() === false) {
echo '<p class="edit_user_labels">'.__('Profiles/Groups assigned to this user').'</p>';
}
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
if (is_metaconsole() === true) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
if (is_metaconsole() === true) {
$table->width = '100%';
$table->class = 'databox data';
$table->title = __('Profiles/Groups assigned to this user');
@ -983,32 +971,32 @@ if (is_metaconsole() === true) {
$table->headstyle[] = 'background-color: #82B93C';
$table->headstyle[] = 'background-color: #82B93C';
$table->headstyle[] = 'background-color: #82B93C';
}
}
$table->data = [];
$table->head = [];
$table->align = [];
$table->style = [];
$table->data = [];
$table->head = [];
$table->align = [];
$table->style = [];
if (is_metaconsole() === false) {
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->head[0] = __('Profile name');
$table->head[1] = __('Group');
$table->head[2] = __('Tags');
$table->align = [];
$table->align[1] = 'left';
$table->data = [];
$table->data = [];
$result = db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $id);
if ($result === false) {
$result = db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $id);
if ($result === false) {
$result = [];
}
}
foreach ($result as $profile) {
foreach ($result as $profile) {
$data[0] = '<b>'.profile_get_name($profile['id_perfil']).'</b>';
if ($config['show_group_name']) {
$data[1] = ui_print_group_icon(
@ -1028,18 +1016,18 @@ foreach ($result as $profile) {
$data[2] = tags_get_tags_formatted($tags);
array_push($table->data, $data);
}
}
if (!empty($table->data)) {
if (!empty($table->data)) {
html_print_table($table);
} else {
} else {
ui_print_info_message(['no_close' => true, 'message' => __('This user doesn\'t have any assigned profile/group.') ]);
}
}
// Close edit_user_profiles.
echo '</div>';
// Close edit_user_profiles.
echo '</div>';
if (is_metaconsole() === false) {
if (is_metaconsole() === false) {
?>
<style>
@ -1067,9 +1055,9 @@ if (is_metaconsole() === false) {
echo '<script type="text/javascript" src="'.ui_get_full_url('include/javascript/timezonepicker/lib/jquery.timezone-picker.min.js').'"></script>'."\n\t";
echo '<script type="text/javascript" src="'.ui_get_full_url('include/javascript/timezonepicker/lib/jquery.maphilight.min.js').'"></script>'."\n\t";
// Closes no meta condition.
}
}
?>
?>
<script language="javascript" type="text/javascript">