1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Extend /users API endpoint

* add /users/{id} to get a single user
* add variable to print fields that are otherwise hidden (e.g. email)
This commit is contained in:
Jascha Sticher
2021-05-06 11:10:49 +02:00
parent 07626669da
commit 4cbd1a9eb5
5 changed files with 35 additions and 9 deletions

View File

@ -9,14 +9,15 @@ abstract class ApiController extends Controller
{
protected $rules = [];
protected $printHidden = [];
/**
* Provide a paginated listing JSON response in a standard format
* taking into account any pagination parameters passed by the user.
*/
protected function apiListingResponse(Builder $query, array $fields): JsonResponse
protected function apiListingResponse(Builder $query, array $fields, array $protectedFieldsToPrint = []): JsonResponse
{
$listing = new ListingResponseBuilder($query, request(), $fields);
$listing = new ListingResponseBuilder($query, request(), $fields, $protectedFieldsToPrint);
return $listing->toResponse();
}