Skip to content

Commit fcbf5d2

Browse files
Merge pull request #1880 from nextcloud/backport/1863/stable31
[stable31] lighter api to get circles
2 parents c027e85 + 638325b commit fcbf5d2

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

appinfo/routes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
// LocalController
1414
['name' => 'Local#circles', 'url' => '/circles', 'verb' => 'GET'],
15+
['name' => 'Local#probeCircles', 'url' => '/probecircles', 'verb' => 'GET'],
1516
['name' => 'Local#create', 'url' => '/circles', 'verb' => 'POST'],
1617
['name' => 'Local#destroy', 'url' => '/circles/{circleId}', 'verb' => 'DELETE'],
1718
['name' => 'Local#search', 'url' => '/search', 'verb' => 'GET'],

lib/Controller/LocalController.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,34 @@ public function circles(int $limit = -1, int $offset = 0): DataResponse {
423423
}
424424

425425

426+
/**
427+
* @NoAdminRequired
428+
*
429+
* @param int $limit
430+
* @param int $offset
431+
*
432+
* @return DataResponse
433+
* @throws OCSException
434+
*/
435+
public function probeCircles(int $limit = -1, int $offset = 0): DataResponse {
436+
try {
437+
$this->setCurrentFederatedUser();
438+
439+
$probe = new CircleProbe();
440+
$probe->filterHiddenCircles()
441+
->filterBackendCircles()
442+
->addDetail(BasicProbe::DETAILS_POPULATION)
443+
->setItemsLimit($limit)
444+
->setItemsOffset($offset);
445+
446+
return new DataResponse($this->serializeArray($this->circleService->probeCircles($probe)));
447+
} catch (Exception $e) {
448+
$this->e($e);
449+
throw new OCSException($e->getMessage(), (int)$e->getCode());
450+
}
451+
}
452+
453+
426454
/**
427455
* @NoAdminRequired
428456
*

0 commit comments

Comments
 (0)