-
Notifications
You must be signed in to change notification settings - Fork 0
User Roles API
CodingMarco edited this page May 11, 2021
·
1 revision
- A user can be assigned roles which grant certain permissions to that user
- A user can also have no roles
- There are currently only two roles implemented in this Projekt: "Webmaster" and "Vorstand", because more are not needed
- Role names are case sensitive
- Only the webmaster can change the roles of a user and see the roles of all users as part of the Get user info API call
- The first user created is automatically assigned the "Webmaster" role
- Sets the roles of a user to the specified roles.
- "Webmaster" role required
- There is no "add role" or "remove role", you just overwrite the roles of a user.
PUT: /api/users/user_roles
Json Parameters:
-
user_id
: The id of the target user -
roles
: Array of role names that should be assigned to the user. Roles can only be "Webmaster" or "Vorstand". To remove all roles, send an empty array.
Return value:
-
success
:true
when successful, otherwisefalse
. In the second case, an error object is returned as described here.
- Gets the roles of a user.
- "Webmaster" role required
GET: /api/users/user_roles
Json Parameters:
-
user_id
: The id of the target user
Return value:
-
roles
: An array containing the role names assigned to the user. Empty array if the user has no roles. -
success
:true
when successful, otherwisefalse
. In the second case, an error object is returned as described here.