WIP: Improve somethings

This commit is contained in:
Jose Gonzalez 2023-02-03 16:36:04 +01:00
parent e3b2ec529a
commit a9df7e2ec5
2 changed files with 118 additions and 75 deletions

View File

@ -28,7 +28,7 @@
// Load global vars.
global $config;
hd($_REQUEST);
// hd($_REQUEST); //TODO. For testing purposes.
check_login();
require_once $config['homedir'].'/vendor/autoload.php';
@ -1424,7 +1424,7 @@ $size_pagination .= html_print_input_text(
true
).'</div>';
if ($id == $config['id_user']) {
if ($id === $config['id_user']) {
$language .= html_print_input_hidden(
'quick_language_change',
1,
@ -1432,7 +1432,7 @@ if ($id == $config['id_user']) {
);
}
if (enterprise_installed() && defined('METACONSOLE')) {
if (enterprise_installed() && is_metaconsole() === true) {
$user_info_metaconsole_access = 'only_console';
if (isset($user_info['metaconsole_access'])) {
$user_info_metaconsole_access = $user_info['metaconsole_access'];
@ -1457,36 +1457,37 @@ if (enterprise_installed() && defined('METACONSOLE')) {
).'</div>';
}
$not_login = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Not Login').'</p>';
$not_login .= ui_print_help_tip(
/*
$not_login = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Not Login').'</p>';
$not_login .= ui_print_help_tip(
__('The user with not login set only can access to API.'),
true
);
$not_login .= html_print_checkbox_switch(
);
$not_login .= html_print_checkbox_switch(
'not_login',
1,
$user_info['not_login'],
true
).'</div>';
).'</div>';
$local_user = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Local user').'</p>';
$local_user .= ui_print_help_tip(
$local_user = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Local user').'</p>';
$local_user .= ui_print_help_tip(
__('The user with local authentication enabled will always use local authentication.'),
true
);
$local_user .= html_print_checkbox_switch(
);
$local_user .= html_print_checkbox_switch(
'local_user',
1,
$user_info['local_user'],
true
).'</div>';
).'</div>';
$session_time = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Session Time');
$session_time .= ui_print_help_tip(
$session_time = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Session Time');
$session_time .= ui_print_help_tip(
__('This is defined in minutes, If you wish a permanent session should putting -1 in this field.'),
true
).'</p>';
$session_time .= html_print_input_text(
).'</p>';
$session_time .= html_print_input_text(
'session_time',
$user_info['session_time'],
'',
@ -1496,8 +1497,8 @@ $session_time .= html_print_input_text(
false,
'',
'class="input_line_small"'
).'</div>';
).'</div>';
*/
$user_groups = implode(',', array_keys((users_get_groups($id, 'AR', $display_all_group))));
if (empty($user_groups) === false) {
@ -1820,33 +1821,15 @@ echo '</div>
<div class="edit_user_comments">'.$comments.'</div>
</div>';
html_print_div(
[
'class' => 'user_edit_third_row white_box',
'content' => html_print_div(
[
'class' => 'edit_user_allowed_ip',
'content' => $allowedIP,
],
true
),
]
);
if (!empty($ehorus)) {
echo '<div class="user_edit_third_row white_box">'.$ehorus.'</div>';
}
echo '</div>';
echo '<div class="action-buttons w100p">';
if ($config['admin_can_add_user']) {
html_print_csrf_hidden();
if ($new_user) {
html_print_input_hidden('create_user', 1);
} else {
html_print_input_hidden('update_user', 1);
}
html_print_input_hidden((($new_user === true) ? 'create_user' : 'update_user'), 1);
}
echo '</div>';
@ -1857,40 +1840,38 @@ if ($new_user === true) {
echo '</form>';
if ($is_err === true && $new_user === true) {
profile_print_profile_table($id, io_safe_output($json_profile), false, true);
} else {
profile_print_profile_table($id, io_safe_output($json_profile));
}
$actionButtons = [];
echo '<br />';
echo '<div class="action-buttons w100p">';
if ($config['admin_can_add_user']) {
if ($new_user) {
html_print_submit_button(
__('Create'),
'crtbutton',
false,
[
'icon' => 'wand',
'form' => 'user_profile_form',
]
);
if ((bool) $config['admin_can_add_user'] === true) {
if ($new_user === true) {
$submitButtonCaption = __('Create');
$submitButtonName = 'crtbutton';
$submitButtonIcon = 'wand';
} else {
html_print_submit_button(
__('Update'),
'uptbutton',
false,
[
'icon' => 'update',
'form' => 'user_profile_form',
]
);
$submitButtonCaption = __('Update');
$submitButtonName = 'uptbutton';
$submitButtonIcon = 'update';
}
$actionButtons[] = html_print_submit_button(
$submitButtonCaption,
$submitButtonName,
false,
[
'icon' => $submitButtonIcon,
'form' => 'user_profile_form',
],
true
);
}
echo '</div>';
$actionButtons[] = html_print_go_back_button(
ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure=0'),
['button_class' => ''],
true
);
html_print_action_buttons(implode('', $actionButtons), ['type' => 'form_action']);
echo '</div>';

View File

@ -585,6 +585,10 @@ $userManagementTable->data['title_additionalSettings'][1] = html_print_subtitle_
$userManagementTable->rowclass['captions_addSettings'] = 'field_half_width pdd_t_10px';
$userManagementTable->rowclass['fields_addSettings'] = 'field_half_width';
$userManagementTable->cellstyle['fields_addSettings'][1] = 'flex-wrap: wrap';
$userManagementTable->cellstyle['captions_addSettings'][1] = 'width: 35%';
$userManagementTable->cellstyle['captions_addSettings'][2] = 'width: 15%';
$userManagementTable->cellstyle['fields_addSettings'][1] = 'width: 35%';
$userManagementTable->cellstyle['fields_addSettings'][2] = 'width: 15%';
$userManagementTable->data['captions_addSettings'][0] = __('Comments');
$userManagementTable->data['fields_addSettings'][0] = html_print_textarea(
'comments',
@ -600,16 +604,23 @@ $userManagementTable->data['captions_addSettings'][1] .= ui_print_help_tip(
__('Add the source IPs that will allow console access. Each IP must be separated only by comma. * allows all.'),
true
);
$userManagementTable->data['fields_addSettings'][1] = html_print_textarea(
'allowed_ip_list',
2,
65,
$user_info['allowed_ip_list'],
(((bool) $view_mode === true) ? 'readonly="readonly"' : ''),
$userManagementTable->data['fields_addSettings'][1] = html_print_div(
[
'class' => 'edit_user_allowed_ip',
'content' => html_print_textarea(
'allowed_ip_list',
2,
65,
$user_info['allowed_ip_list'],
(((bool) $view_mode === true) ? 'readonly="readonly"' : ''),
true
),
],
true
);
$userManagementTable->data['fields_addSettings'][1] .= html_print_div(
$userManagementTable->data['captions_addSettings'][2] = __('Allow all IPs');
$userManagementTable->data['fields_addSettings'][2] = html_print_div(
[
'class' => 'margin-top-10',
'content' => html_print_checkbox_switch(
@ -617,9 +628,60 @@ $userManagementTable->data['fields_addSettings'][1] .= html_print_div(
0,
$user_info['allowed_ip_active'],
true
).'<span class="margin-top-10">'.__('Allow all IPs').'</span>',
),
],
true
);
$userManagementTable->rowclass['captions_loginErrorUser'] = 'field_half_width pdd_t_10px';
$userManagementTable->rowclass['fields_loginErrorUser'] = 'field_half_width';
$userManagementTable->cellstyle['captions_loginErrorUser'][0] = 'width: 25%';
$userManagementTable->cellstyle['captions_loginErrorUser'][1] = 'width: 25%';
$userManagementTable->cellstyle['fields_loginErrorUser'][0] = 'width: 25%';
$userManagementTable->cellstyle['fields_loginErrorUser'][1] = 'width: 25%';
$userManagementTable->data['captions_loginErrorUser'][0] = __('Not Login');
$userManagementTable->data['captions_loginErrorUser'][0] .= ui_print_help_tip(
__('The user with not login set only can access to API.'),
true
);
$userManagementTable->data['fields_loginErrorUser'][0] = html_print_checkbox_switch(
'not_login',
1,
$user_info['not_login'],
true
);
$userManagementTable->data['captions_loginErrorUser'][1] = __('Local user');
$userManagementTable->data['captions_loginErrorUser'][1] .= ui_print_help_tip(
__('The user with local authentication enabled will always use local authentication.'),
true
);
$userManagementTable->data['fields_loginErrorUser'][1] = html_print_checkbox_switch(
'local_user',
1,
$user_info['local_user'],
true
);
$userManagementTable->data['captions_loginErrorUser'][2] = __('Session time');
$userManagementTable->data['captions_loginErrorUser'][2] .= ui_print_help_tip(
__('This is defined in minutes, If you wish a permanent session should putting -1 in this field.'),
true
);
$userManagementTable->data['fields_loginErrorUser'][2] = html_print_input_text(
'session_time',
$user_info['session_time'],
'',
5,
5,
true.false,
false,
'',
'class="input_line_small"'
);
html_print_table($userManagementTable);
// User Profile definition table.
profile_print_profile_table($id, io_safe_output($json_profile), false, ($is_err === true && $new_user === true));