From 306a7581aba6e75359485ea915efa8c248db3556 Mon Sep 17 00:00:00 2001 From: andi Date: Sat, 29 Jan 2005 17:51:40 +0100 Subject: groupfilter for LDAP added darcs-hash:20050129165140-9977f-f3138e26169b9da972af009727422b6a8f95c037.gz --- inc/auth_ldap.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/auth_ldap.php b/inc/auth_ldap.php index d8302e1fc..1376f883e 100644 --- a/inc/auth_ldap.php +++ b/inc/auth_ldap.php @@ -87,6 +87,7 @@ function auth_checkPass($user,$pass){ * * @author Andreas Gohr * @author Trouble + * @author Dan Allen */ function auth_getUserData($user){ global $conf; @@ -116,13 +117,15 @@ function auth_getUserData($user){ $info['mail']= $result[0]['mail'][0]; $info['name']= $result[0]['cn'][0]; $info['uid'] = $result[0]['uid'][0]; - + //primary group id $gid = $result[0]['gidnumber'][0]; //get groups for given user if grouptree is given if ($cnf['grouptree'] != '') { - $filter = "(&(objectClass=posixGroup)(|(gidNumber=$gid)(memberUID=".$info['uid'].")))"; + $filter = str_replace('%i', $info['uid'], $cnf['groupfilter']); + $filter = str_replace('%u', $info['name'], $filter); + $filter = str_replace('%g', $gid, $filter); $sr = @ldap_search($conn, $cnf['grouptree'], $filter); if(!$sr){ msg("LDAP: Reading group memberships failed",-1); -- cgit v1.2.3