diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2012-04-15 14:20:33 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2012-04-15 14:50:03 +0200 |
commit | 8a6fa65ed6dcd7b81891e9a06b771c1c464ebcb9 (patch) | |
tree | b77b50e2414b9dd785732cf5997c3bde4d6a3836 /apps | |
parent | b48007194671de331c3757d1ade210a4af0f8c59 (diff) | |
download | nextcloud-server-8a6fa65ed6dcd7b81891e9a06b771c1c464ebcb9.tar.gz nextcloud-server-8a6fa65ed6dcd7b81891e9a06b771c1c464ebcb9.zip |
group LDAP: implemented getUsersInGroup()
Diffstat (limited to 'apps')
-rw-r--r-- | apps/user_ldap/group_ldap.php | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php index 92bc59c0def..19a488b8434 100644 --- a/apps/user_ldap/group_ldap.php +++ b/apps/user_ldap/group_ldap.php @@ -69,14 +69,8 @@ class OC_GROUP_LDAP extends OC_Group_Backend { $this->ldapGroupFilter, LDAP_GROUP_MEMBER_ASSOC_ATTR.'='.$uid )); - $groups = OC_LDAP::search($filter, $this->ldapGroupDisplayName); - - if(is_array($groups)) { - return $groups; - } - //error cause actually, maybe throw an exception in future. - return array(); + return $this->retrieveList($filter, $this->ldapGroupDisplayName); } /** @@ -84,7 +78,12 @@ class OC_GROUP_LDAP extends OC_Group_Backend { * @returns array with user ids */ public function getUsersInGroup($gid) { - return array(); + $filter = OC_LDAP::combineFilterWithAnd(array( + $this->ldapGroupFilter, + $this->ldapGroupDisplayName.'='.$gid + )); + + return $this->retrieveList($filter, OC_LDAP::ldapUserDisplayName); } /** @@ -103,4 +102,15 @@ class OC_GROUP_LDAP extends OC_Group_Backend { } } + private function retrieveList($filter, $attr) { + $list = OC_LDAP::search($filter, $attr); + + if(is_array($list)) { + return array_unique($list, SORT_LOCALE_STRING); + } + + //error cause actually, maybe throw an exception in future. + return array(); + } + }
\ No newline at end of file |