packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/ldap.php
changeset 3 a044870a9d3d
parent 0 3906ca745819
child 4 2212b2ded8bf
equal deleted inserted replaced
2:700d61d93b1b 3:a044870a9d3d
   351 			return false;
   351 			return false;
   352 	}
   352 	}
   353 	
   353 	
   354 	return ldap_delete($_ldapconn, ldap_make_group_dn($cn));
   354 	return ldap_delete($_ldapconn, ldap_make_group_dn($cn));
   355 }
   355 }
       
   356 
       
   357 /**
       
   358  * Is the given username in the specified LDAP group?
       
   359  * @param string username
       
   360  * @param string Group name
       
   361  * @return bool
       
   362  */
       
   363 
       
   364 function ldap_test_group_membership($username, $group)
       
   365 {
       
   366 	global $_ldapconn, $ldap_group_basedn;
       
   367 	
       
   368 	$filter = sprintf('(&(memberUid=%s)(cn=%s)(objectClass=posixGroup))', ldap_escape($username), ldap_escape($group));
       
   369 	
       
   370 	$result = ldap_search($_ldapconn, $ldap_group_basedn, $filter);
       
   371 	return ldap_count_entries($_ldapconn, $result) > 0;
       
   372 }