Skip to content

Commit

Permalink
Merge pull request #1878 from nextcloud/backport/1863/stable29
Browse files Browse the repository at this point in the history
[stable29] lighter api to get circles
  • Loading branch information
ArtificialOwl authored Feb 18, 2025
2 parents 7d3b47c + 0c7bdb7 commit 1426bbc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

// LocalController
['name' => 'Local#circles', 'url' => '/circles', 'verb' => 'GET'],
['name' => 'Local#probeCircles', 'url' => '/probecircles', 'verb' => 'GET'],
['name' => 'Local#create', 'url' => '/circles', 'verb' => 'POST'],
['name' => 'Local#destroy', 'url' => '/circles/{circleId}', 'verb' => 'DELETE'],
['name' => 'Local#search', 'url' => '/search', 'verb' => 'GET'],
Expand Down
28 changes: 28 additions & 0 deletions lib/Controller/LocalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,34 @@ public function circles(int $limit = -1, int $offset = 0): DataResponse {
}


/**
* @NoAdminRequired
*
* @param int $limit
* @param int $offset
*
* @return DataResponse
* @throws OCSException
*/
public function probeCircles(int $limit = -1, int $offset = 0): DataResponse {
try {
$this->setCurrentFederatedUser();

$probe = new CircleProbe();
$probe->filterHiddenCircles()
->filterBackendCircles()
->addDetail(BasicProbe::DETAILS_POPULATION)
->setItemsLimit($limit)
->setItemsOffset($offset);

return new DataResponse($this->serializeArray($this->circleService->probeCircles($probe)));
} catch (Exception $e) {
$this->e($e);
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}


/**
* @NoAdminRequired
*
Expand Down

0 comments on commit 1426bbc

Please sign in to comment.