diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php index 92bc59c0defa6fb37d1d3f7cd4f43bc63e0c3915..19a488b8434dc48e6fd8e015f36e23a597143b3e 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