Skip to content
Snippets Groups Projects
Commit 7a06e144 authored by Arthur Schiwon's avatar Arthur Schiwon
Browse files

LDAP: central function for user and group list retrieval (will replace...

LDAP: central function for user and group list retrieval (will replace retrieveList from group part)
parent 2296521a
Branches
No related tags found
No related merge requests found
...@@ -371,6 +371,27 @@ class OC_LDAP { ...@@ -371,6 +371,27 @@ class OC_LDAP {
return !OCP\DB::isError($res); 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 * @brief reads a given attribute for an LDAP record identified by a DN
* @param $dn the record in question * @param $dn the record in question
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment