/whoami: added docs

This commit is contained in:
dogeystamp 2023-06-14 22:12:40 -04:00
parent c99cdcdff0
commit 5333ee76ba
2 changed files with 19 additions and 1 deletions

View File

@ -247,7 +247,7 @@
[-] implement /whoami endpoint [-] implement /whoami endpoint
[ ] tests [ ] tests
[ ] docs [x] docs
[ ] investigate cleanup being in the user subcmd [ ] investigate cleanup being in the user subcmd
[ ] investigate cleanup cmd triggering foreign key failure [ ] investigate cleanup cmd triggering foreign key failure

View File

@ -4,6 +4,8 @@ Permissions
Sachet offers a selection of permissions that can be assigned to users, Sachet offers a selection of permissions that can be assigned to users,
which manage their access to certain endpoints. which manage their access to certain endpoints.
.. _permissions_serialization:
Serialization Serialization
------------- -------------
In Sachet's JSON API, permissions are serialized as an array of string codes. In Sachet's JSON API, permissions are serialized as an array of string codes.
@ -59,3 +61,19 @@ The following is a table of permissions Sachet offers, and what they do:
* - Administration * - Administration
- ``ADMIN`` - ``ADMIN``
- Allows creating users and managing their permissions. - Allows creating users and managing their permissions.
Whoami API
----------
Information about the current user and their permissions can be obtained through this API.
``GET /whoami`` will return a result like this:
.. code-block:: json
{
"username": "user",
"permissions": ["READ", "CREATE"]
}
``permissions`` will be serialized as in :ref:`permissions_serialization`.
If the user is not currently signed in, ``username`` will be ``null``.