summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-05-03 23:38:55 +0200
committerArthur Schiwon <blizzz@owncloud.com>2012-05-04 13:26:07 +0200
commit7a06e144ec71ef162bfc4fece886e3cb3f8d1188 (patch)
tree43423fd55a32705e7d0e7606bda5c859c1007ef0 /apps/user_ldap
parent2296521a2efe8c7f0c26b94ddb5a8d1de28a1b3b (diff)
downloadnextcloud-server-7a06e144ec71ef162bfc4fece886e3cb3f8d1188.tar.gz
nextcloud-server-7a06e144ec71ef162bfc4fece886e3cb3f8d1188.zip
LDAP: central function for user and group list retrieval (will replace retrieveList from group part)
Diffstat (limited to 'apps/user_ldap')
-rwxr-xr-xapps/user_ldap/lib_ldap.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/apps/user_ldap/lib_ldap.php b/apps/user_ldap/lib_ldap.php
index 2571ff8d76f..52cc8616e2b 100755
--- a/apps/user_ldap/lib_ldap.php
+++ b/apps/user_ldap/lib_ldap.php
@@ -371,6 +371,27 @@ class OC_LDAP {
return !OCP\DB::isError($res);
}
+ static public function fetchListOfUsers($filter, $attr) {
+ return self::fetchList(OC_LDAP::searchUsers($filter, $attr), (count($attr) > 1));
+ }
+
+ static public function fetchListOfGroups($filter, $attr) {
+ return self::fetchList(OC_LDAP::searchGroups($filter, $attr), (count($attr) > 1));
+ }
+
+ static private function fetchList($list, $manyAttributes) {
+ if(is_array($list)) {
+ if($manyAttributes) {
+ return $list;
+ } else {
+ return array_unique($list, SORT_LOCALE_STRING);
+ }
+ }
+
+ //error cause actually, maybe throw an exception in future.
+ return array();
+ }
+
/**
* @brief reads a given attribute for an LDAP record identified by a DN
* @param $dn the record in question