aboutsummaryrefslogtreecommitdiffstats
path: root/lib/group
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-14 10:20:00 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-14 10:22:13 -0400
commit4c7fd8cd0191871e48704f693f48554d4ee7a726 (patch)
treea66a930783de938deaa3d2362dcf779e5c2b45af /lib/group
parent64ef1e21819979d7fdc406d2628bc175b16fe554 (diff)
parent62e4f55f721971dacd06649cecefe0487626aa75 (diff)
downloadnextcloud-server-4c7fd8cd0191871e48704f693f48554d4ee7a726.tar.gz
nextcloud-server-4c7fd8cd0191871e48704f693f48554d4ee7a726.zip
Merge branch 'master' into share_api
Conflicts: lib/group.php lib/group/backend.php lib/group/database.php lib/group/interface.php lib/public/user.php lib/user.php lib/user/backend.php lib/user/database.php lib/user/interface.php
Diffstat (limited to 'lib/group')
-rw-r--r--lib/group/backend.php5
-rw-r--r--lib/group/database.php24
-rw-r--r--lib/group/dummy.php4
-rw-r--r--lib/group/example.php4
-rw-r--r--lib/group/interface.php4
5 files changed, 25 insertions, 16 deletions
diff --git a/lib/group/backend.php b/lib/group/backend.php
index 73fc402a9ab..5969986c652 100644
--- a/lib/group/backend.php
+++ b/lib/group/backend.php
@@ -105,7 +105,8 @@ abstract class OC_Group_Backend implements OC_Group_Interface {
*
* Returns a list with all groups
*/
- public function getGroups($search = '', $limit = 10, $offset = 0) {
+
+ public function getGroups($search = '', $limit = -1, $offset = 0) {
return array();
}
@@ -122,7 +123,7 @@ abstract class OC_Group_Backend implements OC_Group_Interface {
* @brief get a list of all users in a group
* @returns array with user ids
*/
- public function usersInGroup($gid){
+ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
return array();
}
diff --git a/lib/group/database.php b/lib/group/database.php
index b989f6ae028..0b4ae393cf1 100644
--- a/lib/group/database.php
+++ b/lib/group/database.php
@@ -164,8 +164,12 @@ class OC_Group_Database extends OC_Group_Backend {
*
* Returns a list with all groups
*/
- public function getGroups($search = '', $limit = 10, $offset = 0) {
- $query = OC_DB::prepare('SELECT gid FROM *PREFIX*groups WHERE gid LIKE ? LIMIT '.$limit.' OFFSET '.$offset);
+ public function getGroups($search = '', $limit = -1, $offset = 0) {
+ if ($limit == -1) {
+ $query = OC_DB::prepare('SELECT gid FROM *PREFIX*groups WHERE gid LIKE ?');
+ } else {
+ $query = OC_DB::prepare('SELECT gid FROM *PREFIX*groups WHERE gid LIKE ? LIMIT '.$limit.' OFFSET '.$offset);
+ }
$result = $query->execute(array($search.'%'));
$groups = array();
while ($row = $result->fetchRow()) {
@@ -192,12 +196,16 @@ class OC_Group_Database extends OC_Group_Backend {
* @brief get a list of all users in a group
* @returns array with user ids
*/
- public function usersInGroup($gid){
- $query=OC_DB::prepare('SELECT uid FROM *PREFIX*group_user WHERE gid=?');
- $users=array();
- $result=$query->execute(array($gid));
- while($row=$result->fetchRow()){
- $users[]=$row['uid'];
+ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
+ if ($limit == -1) {
+ $query = OC_DB::prepare('SELECT uid FROM *PREFIX*group_user WHERE gid = ? AND uid LIKE ?');
+ } else {
+ $query = OC_DB::prepare('SELECT uid FROM *PREFIX*group_user WHERE gid = ? AND uid LIKE ? LIMIT '.$limit.' OFFSET '.$offset);
+ }
+ $result = $query->execute(array($gid, $search.'%'));
+ $users = array();
+ while ($row = $result->fetchRow()) {
+ $users[] = $row['uid'];
}
return $users;
}
diff --git a/lib/group/dummy.php b/lib/group/dummy.php
index 1243891023f..51eca28f3f4 100644
--- a/lib/group/dummy.php
+++ b/lib/group/dummy.php
@@ -141,7 +141,7 @@ class OC_Group_Dummy extends OC_Group_Backend {
*
* Returns a list with all groups
*/
- public function getGroups(){
+ public function getGroups($search = '', $limit = -1, $offset = 0) {
return array_keys($this->groups);
}
@@ -149,7 +149,7 @@ class OC_Group_Dummy extends OC_Group_Backend {
* @brief get a list of all users in a group
* @returns array with user ids
*/
- public function usersInGroup($gid){
+ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
if(isset($this->groups[$gid])){
return $this->groups[$gid];
}else{
diff --git a/lib/group/example.php b/lib/group/example.php
index 9c9ece5ac77..76d12629763 100644
--- a/lib/group/example.php
+++ b/lib/group/example.php
@@ -91,7 +91,7 @@ abstract class OC_Group_Example {
*
* Returns a list with all groups
*/
- abstract public static function getGroups();
+ abstract public static function getGroups($search = '', $limit = -1, $offset = 0);
/**
* check if a group exists
@@ -104,6 +104,6 @@ abstract class OC_Group_Example {
* @brief get a list of all users in a group
* @returns array with user ids
*/
- abstract public static function usersInGroup($gid);
+ abstract public static function usersInGroup($gid, $search = '', $limit = -1, $offset = 0);
}
diff --git a/lib/group/interface.php b/lib/group/interface.php
index 6e492e72748..12cc07a5374 100644
--- a/lib/group/interface.php
+++ b/lib/group/interface.php
@@ -58,7 +58,7 @@ interface OC_Group_Interface {
*
* Returns a list with all groups
*/
- public function getGroups($search = '', $limit = 10, $offset = 0);
+ public function getGroups($search = '', $limit = -1, $offset = 0);
/**
* check if a group exists
@@ -71,6 +71,6 @@ interface OC_Group_Interface {
* @brief get a list of all users in a group
* @returns array with user ids
*/
- public function usersInGroup($gid);
+ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0);
} \ No newline at end of file