Fix processing of the 'all' group. Fixes #9051

All the 'all' group to the list of groups at the end, rather than the
start. This way it will be considered no matter how users login. This
also fixes issues some users had with the original changes.
This commit is contained in:
jim-p 2018-10-23 14:17:57 -04:00
parent 3be699295e
commit 4de1585438
2 changed files with 18 additions and 8 deletions

View File

@ -331,7 +331,7 @@ function get_user_privileges(& $user) {
global $config, $_SESSION;
$authcfg = auth_get_authserver($config['system']['webgui']['authmode']);
$allowed_groups = array('all');
$allowed_groups = array();
$privs = $user['priv'];
if (!is_array($privs)) {
@ -369,12 +369,16 @@ function get_user_privileges(& $user) {
$allowed_groups = local_user_get_groups($user, true);
}
if (is_array($allowed_groups)) {
foreach ($allowed_groups as $name) {
$group = getGroupEntry($name);
if (is_array($group['priv'])) {
$privs = array_merge($privs, $group['priv']);
}
if (!is_array($allowed_groups)) {
$allowed_groups = array('all');
} else {
$allowed_groups[] = 'all';
}
foreach ($allowed_groups as $name) {
$group = getGroupEntry($name);
if (is_array($group['priv'])) {
$privs = array_merge($privs, $group['priv']);
}
}

View File

@ -239,7 +239,7 @@ function getAllowedPages($username, &$attributes = array()) {
}
$allowed_pages = array();
$allowed_groups = array('all');
$allowed_groups = array();
phpsession_begin();
if ($_SESSION['remoteauth']) {
@ -283,6 +283,12 @@ function getAllowedPages($username, &$attributes = array()) {
}
}
if (!is_array($allowed_groups)) {
$allowed_groups = array('all');
} else {
$allowed_groups[] = 'all';
}
// build a list of allowed pages
if (is_array($config['system']['group']) && is_array($allowed_groups)) {
foreach ($config['system']['group'] as $group) {