Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/group
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-07-31 04:20:46 +0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-07-31 04:20:46 +0400
commit2f1a990cadc5202dd20c3ec87e886685f6733595 (patch)
tree4e44165d0d87ad026f45b49a409f1bad87099ac7 /lib/group
parented71343df8a3d35c2a0fe7d6c91778278f8d7dd1 (diff)
Add search, limit, and offset parameters to getUsers() and getGroups()
Diffstat (limited to 'lib/group')
-rw-r--r--lib/group/backend.php2
-rw-r--r--lib/group/database.php12
-rw-r--r--lib/group/interface.php2
3 files changed, 7 insertions, 9 deletions
diff --git a/lib/group/backend.php b/lib/group/backend.php
index ebc078f152a..3f2909caa15 100644
--- a/lib/group/backend.php
+++ b/lib/group/backend.php
@@ -105,7 +105,7 @@ abstract class OC_Group_Backend implements OC_Group_Interface {
*
* Returns a list with all groups
*/
- public function getGroups(){
+ public function getGroups($search = '', $limit = 10, $offset = 0) {
return array();
}
diff --git a/lib/group/database.php b/lib/group/database.php
index 2770ec185c4..6314a127438 100644
--- a/lib/group/database.php
+++ b/lib/group/database.php
@@ -164,15 +164,13 @@ class OC_Group_Database extends OC_Group_Backend {
*
* Returns a list with all groups
*/
- public function getGroups(){
- $query = OC_DB::prepare( "SELECT gid FROM `*PREFIX*groups`" );
- $result = $query->execute();
-
+ public function getGroups($search = '', $limit = 10, $offset = 0) {
+ $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()){
- $groups[] = $row["gid"];
+ while ($row = $result->fetchRow()) {
+ $groups[] = $row['gid'];
}
-
return $groups;
}
diff --git a/lib/group/interface.php b/lib/group/interface.php
index 7cca6061e10..6e492e72748 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();
+ public function getGroups($search = '', $limit = 10, $offset = 0);
/**
* check if a group exists