Standardize privilege page and sorting between users and groups. Fixes #7587

This commit is contained in:
jim-p 2017-05-22 15:42:28 -04:00
parent 8abe827287
commit 2c1a08a8a3
3 changed files with 17 additions and 6 deletions

View File

@ -3244,4 +3244,8 @@ function addrtolower($ip) {
return($ip);
}
}
function compare_by_name($a, $b) {
return strcasecmp($a['name'], $b['name']);
}
?>

View File

@ -53,6 +53,7 @@ if (!is_array($a_group['priv'])) {
// Make a local copy and sort it
$spriv_list = $priv_list;
uasort($spriv_list, "compare_by_name");
if ($_POST['save']) {
@ -146,7 +147,17 @@ if (isset($groupid)) {
));
}
$section = new Form_Section('Add Privileges for '. $a_group['name']);
$section = new Form_Section('Group Privileges');
$name_string = $a_group['name'];
if (!empty($a_group['descr'])) {
$name_string .= " ({$a_group['descr']})";
}
$section->addInput(new Form_StaticText(
'Group',
$name_string
));
$section->addInput(new Form_Select(
'sysprivs',

View File

@ -28,10 +28,6 @@
##|*MATCH=system_usermanager_addprivs.php*
##|-PRIV
function admusercmp($a, $b) {
return strcasecmp($a['name'], $b['name']);
}
require_once("guiconfig.inc");
require_once("pfsense-utils.inc");
@ -55,7 +51,7 @@ if (!is_array($a_user['priv'])) {
// Make a local copy and sort it
$spriv_list = $priv_list;
uasort($spriv_list, "admusercmp");
uasort($spriv_list, "compare_by_name");
if ($_POST['save']) {
unset($input_errors);