summaryrefslogtreecommitdiffstats
path: root/lib/private/group
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2014-06-25 13:13:53 +0200
committerArthur Schiwon <blizzz@owncloud.com>2014-06-25 13:13:53 +0200
commitf3ecf819ec8e6841be62603c3e8a1e255fc6522d (patch)
treee714fb0ea4121c57949f1a47e812a0ca412a6de8 /lib/private/group
parent553c2ad33abc07aff13afa75420a402875b458a4 (diff)
downloadnextcloud-server-f3ecf819ec8e6841be62603c3e8a1e255fc6522d.tar.gz
nextcloud-server-f3ecf819ec8e6841be62603c3e8a1e255fc6522d.zip
extend Dummy user and group implementation to pass tests
Diffstat (limited to 'lib/private/group')
-rw-r--r--lib/private/group/dummy.php33
1 files changed, 30 insertions, 3 deletions
diff --git a/lib/private/group/dummy.php b/lib/private/group/dummy.php
index e48c6a0e266..4af18b267bc 100644
--- a/lib/private/group/dummy.php
+++ b/lib/private/group/dummy.php
@@ -143,7 +143,16 @@ class OC_Group_Dummy extends OC_Group_Backend {
* @return array an array of group names
*/
public function getGroups($search = '', $limit = -1, $offset = 0) {
- return array_keys($this->groups);
+ if(empty($search)) {
+ return array_keys($this->groups);
+ }
+ $result = array();
+ foreach(array_keys($this->groups) as $group) {
+ if(stripos($group, $search) !== false) {
+ $result[] = $group;
+ }
+ }
+ return $result;
}
/**
@@ -156,7 +165,16 @@ class OC_Group_Dummy extends OC_Group_Backend {
*/
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
if(isset($this->groups[$gid])) {
- return $this->groups[$gid];
+ if(empty($search)) {
+ return $this->groups[$gid];
+ }
+ $result = array();
+ foreach($this->groups[$gid] as $user) {
+ if(stripos($user, $search) !== false) {
+ $result[] = $user;
+ }
+ }
+ return $result;
}else{
return array();
}
@@ -172,7 +190,16 @@ class OC_Group_Dummy extends OC_Group_Backend {
*/
public function countUsersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
if(isset($this->groups[$gid])) {
- return count($this->groups[$gid]);
+ if(empty($search)) {
+ return count($this->groups[$gid]);
+ }
+ $count = 0;
+ foreach($this->groups[$gid] as $user) {
+ if(stripos($user, $search) !== false) {
+ $count++;
+ }
+ }
+ return $count;
}
}