From 4acf4eafd70301742e9146921037ed38e107b264 Mon Sep 17 00:00:00 2001 From: Nick Ramser Date: Tue, 1 Aug 2017 16:16:52 -0400 Subject: [PATCH] Added get_group_list() to ldap-authorization. The function was copied from ldap.inc.php --- .../authentication/ldap-authorization.inc.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/html/includes/authentication/ldap-authorization.inc.php b/html/includes/authentication/ldap-authorization.inc.php index f0622f54fa..a26887ebd8 100644 --- a/html/includes/authentication/ldap-authorization.inc.php +++ b/html/includes/authentication/ldap-authorization.inc.php @@ -331,3 +331,25 @@ function auth_ldap_session_cache_set($attr, $value) $_SESSION['auth_ldap'][$attr]['value'] = $value; $_SESSION['auth_ldap'][$attr]['last_updated'] = time(); } + + +function get_group_list() +{ + global $config; + + $ldap_groups = array(); + $default_group = 'cn=groupname,ou=groups,dc=example,dc=com'; + if (isset($config['auth_ldap_group'])) { + if ($config['auth_ldap_group'] !== $default_group) { + $ldap_groups[] = $config['auth_ldap_group']; + } + } + + foreach ($config['auth_ldap_groups'] as $key => $value) { + $dn = "cn=$key,".$config['auth_ldap_groupbase']; + $ldap_groups[] = $dn; + } + + return $ldap_groups; +} +