system: use userIsAdmin() even if we have to resolve again

This commit is contained in:
Franco Fichtner 2019-05-09 12:13:46 +02:00
parent d6a5db4f63
commit ca5140cbf7
2 changed files with 5 additions and 3 deletions

View File

@ -350,8 +350,10 @@ function userHasPrivilege($userent, $privid = false)
return true;
}
function userIsAdmin($username) {
function userIsAdmin($username)
{
$user = getUserEntry($username);
return userHasPrivilege($user, 'page-all');
}
@ -485,7 +487,7 @@ function local_user_set(&$user, $force_password = false)
}
/* admins access gives wheely rights */
if (userHasPrivilege($user, 'page-all')) {
if (userIsAdmin($user['name'])) {
$user_group = 'wheel';
}

View File

@ -998,7 +998,7 @@ $( document ).ready(function() {
<?php
if (isset($userent['disabled'])) {
$usrimg = 'text-muted';
} elseif (userHasPrivilege($userent, 'page-all')) {
} elseif (userIsAdmin($userent['name'])) {
$usrimg = 'text-danger';
} else {
$usrimg = 'text-info';