Authentication
Assignable Roles
Get roles that the current user can assign to other users.
GET /api/auth/assignable-roles
Returns the list of roles that the current user can assign to other users, based on role hierarchy. Users can only assign roles below their own level.
Auth: Required -- any authenticated user
Example
curl https://api.reten.ai/api/auth/assignable-roles \
-H "Authorization: Bearer <token>"import axios from 'axios';
const response = await axios.get(
'https://api.reten.ai/api/auth/assignable-roles',
{
headers: {
Authorization: 'Bearer <token>',
},
}
);
const { assignableRoles, currentUserLevel } = response.data;Response 200 OK
{
"assignableRoles": [
{
"id": "aa0e8400-e29b-41d4-a716-446655440000",
"name": "ADMIN",
"description": "Tenant administrator",
"permissions": [
"CREATE_USER",
"VIEW_USERS",
"UPDATE_USER",
"MANAGE_COMMERCES",
"MANAGE_OPERATORS",
"MANAGE_ROUTES",
"VIEW_ACTIVITIES",
"CREATE_ACTIVITY"
],
"level": 2
},
{
"id": "bb0e8400-e29b-41d4-a716-446655440000",
"name": "FDE",
"description": "Field execution operator",
"permissions": [
"VIEW_ACTIVITIES",
"CREATE_ACTIVITY"
],
"level": 3
}
],
"currentUserLevel": 1
}Notes
- Role hierarchy:
SUPER_ADMIN(level 1) >ADMIN(level 2) >FDE(level 3) - Only roles with a higher level number (lower privilege) than the current user are returned
- This endpoint is cacheable as role hierarchy rarely changes