DRAFT: API endpoint for user management#2734
DRAFT: API endpoint for user management#2734itbane wants to merge 2 commits intoBookStackApp:developmentfrom
Conversation
* add /users/{id} to get a single user
* add variable to print fields that are otherwise hidden (e.g. email)
|
Looks good so far @itbane. The create/update endpoints will be the trickier ones, Lots of conditional logic tied up on those requests. Don't worry about covering every use-case for the initial implementation, simplicity is preferred. If you haven't already worked it out, Comments on the controller methods are automatically used as the description for the endpoint in the docs. We'll also need to ensure requests & responses exist in the dev/api folder which are also used in the docs. Will also need tests to at least cover the main positive case for each endpoint. |
|
Great! It'll take a couple of days, but I'll keep adding endpoints, documentation and tests. |
|
Please, we need those features as soon as posible. It would be awesome to be able to change permissions set of a book, shelves ... using your API |
|
Hi @itbane, How is this going? No massive rush from my side but if you get to a point where you can't progress, or can't devote additional time for any reason, then that's fine but just let me know and I'll consider this as available to pick up & continue. |
- Updated routes to use new format. - Changed how hidden fields are exposed to be more flexible to different use-cases. - Updated properties available on read/list results. - Started adding testing coverage. - Removed old unused UserRepo 'getAllUsers' function. Related to #2701, Progression of #2734
Hi,
I've found the need to get users (and their email) from the API for automation purposes. As there isn't an endpoint for user management yet, I thought I'd give it a shot and tried to implement it.
I'd like to get some feedback on whether I'm on the right track and should continue working on this.
Disclaimer: I haven't worked with Laravel ever before and my last contact with php was ~10 years ago. I'm grateful for any advice and pointers you can give me to improve the PR.
Tests and
CREATE,UPDATE,DELETEoperations are still WIP. I've seen someone request SCIM-Support (#2701) - I'd have to look into that.Current state:
/api/users- Route (only accessible withusers-managepermissions); lists all users + their roles/api/users/{id}- Route (only accessible withusers-managepermissions); lists details of a specific userQuick overview on my changes / thought process:
usersUserApiControllerUserandUserRepo-classes as possibleapiListingResponserequires aBuilder-object,User::getAll()returns a collectionUserRepothat returns aBuilder-objectUser-object are hidden, but need to be displayed, such asemailapiListingResponsethat takes an array of fields that should be returned anyways (usingdata->makeVisible()inListingResponseBuilder::to_response)