Make getting all users and groups the default

This commit is contained in:
Michael Gapczynski 2012-08-11 16:06:31 -04:00
parent 9d2ae5fa1f
commit 874f31b8d7
11 changed files with 21 additions and 13 deletions

View File

@ -237,7 +237,7 @@ class OC_Group {
*
* Returns a list with all groups
*/
public static function getGroups($search = '', $limit = 10, $offset = 0) {
public static function getGroups($search = '', $limit = -1, $offset = 0) {
$groups = array();
foreach (self::$_usedBackends as $backend) {
$groups = array_merge($backend->getGroups($search, $limit, $offset), $groups);

View File

@ -105,7 +105,7 @@ 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();
}

View File

@ -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) {
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()) {

View File

@ -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);
}

View File

@ -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

View File

@ -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

View File

@ -51,7 +51,7 @@ class User {
*
* Get a list of all users.
*/
public static function getUsers($search = '', $limit = 10, $offset = 0) {
public static function getUsers($search = '', $limit = -1, $offset = 0) {
return \OC_USER::getUsers();
}

View File

@ -97,7 +97,7 @@ abstract class OC_User_Backend implements OC_User_Interface {
*
* Get a list of all users.
*/
public function getUsers($search = '', $limit = 10, $offset = 0) {
public function getUsers($search = '', $limit = -1, $offset = 0) {
return array();
}

View File

@ -154,8 +154,12 @@ class OC_User_Database extends OC_User_Backend {
*
* Get a list of all users.
*/
public function getUsers($search = '', $limit = 10, $offset = 0) {
public function getUsers($search = '', $limit = -1, $offset = 0) {
if ($limit == -1) {
$query = OC_DB::prepare('SELECT uid FROM *PREFIX*users WHERE uid LIKE ?');
} else {
$query = OC_DB::prepare('SELECT uid FROM *PREFIX*users WHERE uid LIKE ? LIMIT '.$limit.' OFFSET '.$offset);
}
$result = $query->execute(array($search.'%'));
$users = array();
while ($row = $result->fetchRow()) {

View File

@ -100,7 +100,7 @@ class OC_User_Dummy extends OC_User_Backend {
*
* Get a list of all users.
*/
public function getUsers(){
public function getUsers($search = '', $limit = -1, $offset = 0) {
return array_keys($this->users);
}

View File

@ -48,7 +48,7 @@ interface OC_User_Interface {
*
* Get a list of all users.
*/
public function getUsers($search = '', $limit = 10, $offset = 0);
public function getUsers($search = '', $limit = -1, $offset = 0);
/**
* @brief check if a user exists