Skip to content

Commit

Permalink
Merge pull request #1879 from nextcloud/backport/1863/stable30
Browse files Browse the repository at this point in the history
[stable30] lighter api to get circles
  • Loading branch information
ArtificialOwl authored Feb 18, 2025
2 parents 5057fad + 294bc76 commit 78d94ac
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 @@ -12,6 +12,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 @@ -423,6 +423,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 78d94ac

Please sign in to comment.