mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Teach get_user_privileges how to retrieve groups from LDAP/RADIUS, and have getUserEntry fall back to a format that will allow it to function. Net result is that now userHasPrivilege() will respect remote groups as well as local groups, which fixes #6088
This commit is contained in:
parent
4422bdca8c
commit
100d0f77fe
@ -271,8 +271,14 @@ function index_users() {
|
||||
|
||||
function & getUserEntry($name) {
|
||||
global $debug, $config, $userindex;
|
||||
$authcfg = auth_get_authserver($config['system']['webgui']['authmode']);
|
||||
|
||||
if (isset($userindex[$name])) {
|
||||
return $config['system']['user'][$userindex[$name]];
|
||||
} elseif ($authcfg['type'] != "Local Database") {
|
||||
$user = array();
|
||||
$user['name'] = $name;
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,13 +318,25 @@ function & getGroupEntryByGID($gid) {
|
||||
}
|
||||
|
||||
function get_user_privileges(& $user) {
|
||||
global $config;
|
||||
|
||||
$authcfg = auth_get_authserver($config['system']['webgui']['authmode']);
|
||||
$names = array();
|
||||
|
||||
$privs = $user['priv'];
|
||||
if (!is_array($privs)) {
|
||||
$privs = array();
|
||||
}
|
||||
|
||||
$names = local_user_get_groups($user, true);
|
||||
if ($authcfg['type'] == "ldap") {
|
||||
$names = @ldap_get_groups($user['name'], $authcfg);
|
||||
} elseif ($authcfg['type'] == "radius") {
|
||||
$names = @radius_get_groups($_SESSION['user_radius_attributes']);
|
||||
}
|
||||
|
||||
if (empty($names)) {
|
||||
$names = local_user_get_groups($user, true);
|
||||
}
|
||||
|
||||
foreach ($names as $name) {
|
||||
$group = getGroupEntry($name);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user