mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 17:23:59 -04:00
Merge pull request #36592 from nextcloud/groupmanager-search-typing
fix default values and type hints for GroupManager::search
This commit is contained in:
commit
1f4dd62b4e
4 changed files with 15 additions and 11 deletions
|
|
@ -266,7 +266,7 @@ class Database extends ABackend implements
|
|||
*
|
||||
* Returns a list with all groups
|
||||
*/
|
||||
public function getGroups($search = '', $limit = null, $offset = null) {
|
||||
public function getGroups(string $search = '', int $limit = -1, int $offset = 0) {
|
||||
$this->fixDI();
|
||||
|
||||
$query = $this->dbConn->getQueryBuilder();
|
||||
|
|
@ -283,8 +283,12 @@ class Database extends ABackend implements
|
|||
)));
|
||||
}
|
||||
|
||||
$query->setMaxResults($limit)
|
||||
->setFirstResult($offset);
|
||||
if ($limit > 0) {
|
||||
$query->setMaxResults($limit);
|
||||
}
|
||||
if ($offset > 0) {
|
||||
$query->setFirstResult($offset);
|
||||
}
|
||||
$result = $query->execute();
|
||||
|
||||
$groups = [];
|
||||
|
|
|
|||
|
|
@ -236,14 +236,14 @@ class Manager extends PublicEmitter implements IGroupManager {
|
|||
|
||||
/**
|
||||
* @param string $search
|
||||
* @param int $limit
|
||||
* @param int $offset
|
||||
* @param ?int $limit
|
||||
* @param ?int $offset
|
||||
* @return \OC\Group\Group[]
|
||||
*/
|
||||
public function search($search, $limit = null, $offset = null) {
|
||||
public function search(string $search, ?int $limit = null, ?int $offset = 0) {
|
||||
$groups = [];
|
||||
foreach ($this->backends as $backend) {
|
||||
$groupIds = $backend->getGroups($search, $limit, $offset);
|
||||
$groupIds = $backend->getGroups($search, $limit ?? -1, $offset ?? 0);
|
||||
foreach ($groupIds as $groupId) {
|
||||
$aGroup = $this->get($groupId);
|
||||
if ($aGroup instanceof IGroup) {
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ interface GroupInterface {
|
|||
*
|
||||
* Returns a list with all groups
|
||||
*/
|
||||
public function getGroups($search = '', $limit = -1, $offset = 0);
|
||||
public function getGroups(string $search = '', int $limit = -1, int $offset = 0);
|
||||
|
||||
/**
|
||||
* check if a group exists
|
||||
|
|
|
|||
|
|
@ -96,12 +96,12 @@ interface IGroupManager {
|
|||
|
||||
/**
|
||||
* @param string $search
|
||||
* @param int $limit
|
||||
* @param int $offset
|
||||
* @param ?int $limit
|
||||
* @param ?int $offset
|
||||
* @return \OCP\IGroup[]
|
||||
* @since 8.0.0
|
||||
*/
|
||||
public function search($search, $limit = null, $offset = null);
|
||||
public function search(string $search, ?int $limit = null, ?int $offset = 0);
|
||||
|
||||
/**
|
||||
* @param \OCP\IUser|null $user
|
||||
|
|
|
|||
Loading…
Reference in a new issue