LDAP: adjust getGroups to updated interface
This commit is contained in:
parent
452f55e163
commit
3c1380b093
|
@ -185,18 +185,27 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
|
||||||
*
|
*
|
||||||
* Returns a list with all groups
|
* Returns a list with all groups
|
||||||
*/
|
*/
|
||||||
public function getGroups() {
|
public function getGroups($search = '', $limit = -1, $offset = 0) {
|
||||||
if(!$this->enabled) {
|
if(!$this->enabled) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->connection->isCached('getGroups')) {
|
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->fetchListOfGroups($this->connection->ldapGroupFilter, array($this->connection->ldapGroupDisplayName, 'dn'));
|
||||||
$ldap_groups = $this->ownCloudGroupNames($ldap_groups);
|
$ldap_groups = $this->ownCloudGroupNames($ldap_groups);
|
||||||
$this->connection->writeToCache('getGroups', $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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue