LDAP: adjust getGroups to updated interface

This commit is contained in:
Arthur Schiwon 2012-08-14 14:22:05 +02:00
parent 452f55e163
commit 3c1380b093
1 changed files with 17 additions and 8 deletions

View File

@ -185,18 +185,27 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
*
* Returns a list with all groups
*/
public function getGroups() {
public function getGroups($search = '', $limit = -1, $offset = 0) {
if(!$this->enabled) {
return array();
}
if($this->connection->isCached('getGroups')) {
return $this->connection->getFromCache('getGroups');
}
$ldap_groups = $this->connection->getFromCache('getGroups');
} else {
$ldap_groups = $this->fetchListOfGroups($this->connection->ldapGroupFilter, array($this->connection->ldapGroupDisplayName, 'dn'));
$ldap_groups = $this->ownCloudGroupNames($ldap_groups);
$this->connection->writeToCache('getGroups', $ldap_groups);
}
$this->groupSearch = $search;
if(!empty($this->groupSearch)) {
$ldap_groups = array_filter($ldap_groups, array($this, 'groupMatchesFilter'));
}
return array_slice($ldap_groups, $offset, $limit);
}
return $ldap_groups;
public function groupMatchesFilter($group) {
return (strripos($group, $this->groupSearch) !== false);
}
/**