Compare commits

..

2 Commits

Author SHA1 Message Date
5333ee76ba /whoami: added docs 2023-06-14 22:12:40 -04:00
c99cdcdff0 TODO.txt: updated 2023-06-14 22:04:50 -04:00
2 changed files with 22 additions and 0 deletions

View File

@ -245,6 +245,10 @@
[x] cli [x] cli
[x] getting started (dev) [x] getting started (dev)
[-] implement /whoami endpoint
[ ] tests
[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``.