Skip to content

Commit 3d1c5bc

Browse files
committed
feat: document the /rest/data/user/roles endpoint
1 parent 1feb627 commit 3d1c5bc

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ Features:
223223
hard coded user id number and replacing it with the current user's
224224
id. Tracker templates updated to use it. (John Rouillard from a
225225
patch by Jon C. Thomason)
226+
- Add a /rest/data/user/roles REST endpoint. (John Rouillard)
226227

227228
2023-07-13 2.3.0
228229

doc/rest.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,45 @@ allowed on a given endpoint.
10901090

10911091
Does not support PUT, DELETE or PATCH.
10921092

1093+
/data/user/roles endpoint
1094+
-------------------------
1095+
1096+
The list of valid roles for a user is not an actual class in the
1097+
hyperdb. This endpoint returns a list of all defined roles if the
1098+
user has the ``Admin`` role. Otherwise it returns a 403 - not
1099+
authorized error. The output from this endpoint looks like::
1100+
1101+
{
1102+
"data": {
1103+
"collection": [
1104+
{
1105+
"id": "user",
1106+
"name": "user"
1107+
},
1108+
{
1109+
"id": "admin",
1110+
"name": "admin"
1111+
},
1112+
{
1113+
"id": "anonymous",
1114+
"name": "anonymous"
1115+
}
1116+
]
1117+
}
1118+
}
1119+
1120+
to mimic a class collection.
1121+
1122+
Unlike a real class collection endpoint, ``@total_size`` is not
1123+
returned. Also it does not support any query options like: filtering,
1124+
`@sort`, `@group`, `@verbose` etc. Note that the ``id`` property is
1125+
not numeric.
1126+
1127+
This endpoint was introduced in release 2.4.0 to support a roles
1128+
select/dropdown in the web component classhelper. This lets the web
1129+
component helper implement the same function in the classic user class
1130+
classhelper.
1131+
10931132
/data/\ *class*/\ *id* item
10941133
---------------------------
10951134

0 commit comments

Comments
 (0)