diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2012-08-14 14:22:05 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2012-08-14 14:22:05 +0200 |
commit | 3c1380b093fcfe5d94927529ccc726b4ed56e99f (patch) | |
tree | 38aee75490060e1a820720c9305fb9daa43fe794 /apps/user_ldap/group_ldap.php | |
parent | 452f55e163444e573a8ddbf762fedf6d32b48e8d (diff) | |
download | nextcloud-server-3c1380b093fcfe5d94927529ccc726b4ed56e99f.tar.gz nextcloud-server-3c1380b093fcfe5d94927529ccc726b4ed56e99f.zip |
LDAP: adjust getGroups to updated interface
Diffstat (limited to 'apps/user_ldap/group_ldap.php')
-rw-r--r-- | apps/user_ldap/group_ldap.php | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php index aff25593ef7..d0d1ae30350 100644 --- a/apps/user_ldap/group_ldap.php +++ b/apps/user_ldap/group_ldap.php @@ -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); } - $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); } /** |