diff options
Diffstat (limited to 'etc/inc/auth.inc')
-rw-r--r-- | etc/inc/auth.inc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index 302e1fe..6a0d941 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -1018,6 +1018,33 @@ function auth_get_authserver_list() { return $list; } +function getUserGroups($username, $authcfg) { + global $config; + + $allowed_groups = array(); + + switch($authcfg['type']) { + case 'ldap': + $allowed_groups = @ldap_get_groups($username, $authcfg); + break; + case 'radius': + break; + default: + $user = getUserEntry($username); + $allowed_groups = @local_user_get_groups($user, true); + break; + } + + $member_groups = array(); + if (is_array($config['system']['group'])) { + foreach ($config['system']['group'] as $group) + if (in_array($group['name'], $allowed_groups)) + $member_groups[] = $group['name']; + } + + return $member_groups; +} + function authenticate_user($username, $password, $authcfg = NULL) { if (!$authcfg) { |