Users
Get All Users
GET /api/users
Returns all the Users.
*Requires Admin rights
Supports the list query parameters. GET /api/users/info returns { "count": n } for the same filter.
Get User by ID
GET /api/users/[ID]
Returns the user that corresponds to the user ID.
*Requires Admin rights for other users, Logged in user can get it's own user
Request
| Parameter | Type | Description |
|---|---|---|
| ID | ID | Uuid or the username of the User |
Response
User Object
Create User
POST /api/users
Creates a new User.
*Requires Admin rights
Request Body
1 2 3 4 5 6 7 8 | |
| Parameter | Type | Description |
|---|---|---|
| username | String | The login name. Stored lower-case and unique |
| password | String | |
| name | String | The name of the User - display name |
| roles | UserRole [] | Array of user role names, as returned by Get All User Roles. The built-in names are administrator, studio and nrcs |
| permissions | Array | Permissions granted to this user directly, on top of the roles. Each entry is {folders: [], permissions: []} |
| avatarConfig | Object | Configuration of the generated avatar |
Note
A type given in the body is ignored; a user created through this route is always NORMAL.
Response Body
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
| Parameter | Value | Description |
|---|---|---|
| _id | Uuid | The id of the User |
| username | String | The login name |
| name | String | The name of the User |
| roles | UserRole [] | Array of user role names |
| permissions | Array | Permissions granted to this user directly |
| permissionSet | Object | Added by the server: a map of folder to the permissions the user has there, resolved from the roles and the user's own permissions. The empty key "" holds the permissions granted everywhere |
| settings | Object | The user's Studio settings |
| createdAt | Date | Date and time the user was created |
| updatedAt | Date | Date and time the user was last updated |
password and salt are never returned.
Update User
PUT /api/users/[ID]
Updates the User
*Requires Admin rights for other users, Logged in user can update it's own user
Request
| Parameter | Type | Description |
|---|---|---|
| ID | ID | Uuid or the username of the User |
Request Body
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
The following rules apply:
usernamecannot be changed. Sending a different one fails withInvalid user data.typeis ignored.- A user who is not an administrator cannot change
roles, not even on its own user: the field is removed from the request before it is applied. - On the built-in
adminuser,usernameandrolesare both ignored.
Response
The updated User object.
Set a User's Password
POST /api/users/[ID]/password
Sets the password of the user.
*Requires Admin rights for other users, Logged in user can set it's own password
Request
| Parameter | Type | Description |
|---|---|---|
| ID | ID | Uuid or the username of the User |
Request Body
1 2 3 | |
An empty or missing password fails with Missing password.
Delete User
DELETE /api/users/[ID]
Deletes the user that corresponds to the user ID.
*Requires Admin rights
Request
| Parameter | Type | Description |
|---|---|---|
| ID | ID | Uuid or the username of the User |
Note
The built-in admin user cannot be deleted. The request fails with User admin can't be deleted.
Reset user settings
DELETE /api/users/[ID]/settings
Resets the user settings to the default for the user that corresponds to the user ID.
*Requires Admin rights for other users, Logged in user can reset it's own settings
Request
| Parameter | Type | Description |
|---|---|---|
| ID | ID | Uuid or the name of the User |
Response
The response is the updated User object.
Avatar
Get an Avatar
GET /api/users/[ID]/avatar
Returns the user's uploaded avatar image, or 404 if the user has none.
Upload an Avatar
POST /api/users/[ID]/avatar
Uploads an avatar image for the user. The request is multipart/form-data with the image as the file part.
*Requires Admin rights for other users, Logged in user can upload it's own avatar
Delete an Avatar
DELETE /api/users/[ID]/avatar
Deletes the user's uploaded avatar, or answers 404 if the user has none.
*Requires Admin rights for other users, Logged in user can delete it's own avatar
User Roles
A User Role is a named set of permissions. A user refers to roles by name.
Get All User Roles
GET /api/userroles
Returns all the User Roles. Supports the list query parameters; GET /api/userroles/info returns { "count": n }.
*Requires Admin rights
Get the Available Role Names
GET /api/userroles/available
Returns every role as {_id, name, builtIn}, without the permission sets. Any logged-in user may call it, so that a client can offer the list of roles without Admin rights.
Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
Get a User Role by ID
GET /api/userroles/[ID]
Returns one User Role, by Uuid or by name. Unknown ids answer 404.
*Requires Admin rights
Create a User Role
POST /api/userroles
Creates a new role.
*Requires Admin rights
Request Body
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
name is stored lower-case and must be unique.
Update a User Role
PUT /api/userroles/[ID]
Updates a role. The body is a partial User Role.
*Requires Admin rights
Delete a User Role
DELETE /api/userroles/[ID]
Deletes a role.
*Requires Admin rights