141 lines
1.8 KiB
Markdown
141 lines
1.8 KiB
Markdown
## GET /api/v1/role/{id}
|
|
|
|
_Requires an authorization header_
|
|
|
|
Returns a role with id = {id}
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"name": "string",
|
|
"description": "string",
|
|
"communityId": "string",
|
|
"permissions": "string[]",
|
|
"creationDate": "number"
|
|
}
|
|
```
|
|
|
|
## POST /api/v1/role
|
|
|
|
_Requires an authorization header_
|
|
|
|
### Request:
|
|
|
|
```json
|
|
{
|
|
"name": "string",
|
|
"communityId": "string",
|
|
"permissions": "string[]"
|
|
}
|
|
```
|
|
|
|
Creates a new role and returns it
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"name": "string",
|
|
"description": "string",
|
|
"communityId": "string",
|
|
"permissions": "string[]",
|
|
"creationDate": "number"
|
|
}
|
|
```
|
|
|
|
## PATCH /api/v1/role/{id}
|
|
|
|
_Requires an authorization header_
|
|
|
|
### Request:
|
|
|
|
```json
|
|
{
|
|
"name": "string?",
|
|
"description": "string?",
|
|
"permissions": "string[]?"
|
|
}
|
|
```
|
|
|
|
Updates a role with id = {id}
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"name": "string",
|
|
"description": "string",
|
|
"communityId": "string",
|
|
"permissions": "string[]",
|
|
"creationDate": "number"
|
|
}
|
|
```
|
|
|
|
## POST /api/v1/role/{id}/assign
|
|
|
|
_Requires an authorization header_
|
|
|
|
### Request:
|
|
|
|
```json
|
|
{
|
|
"userId": "string"
|
|
}
|
|
```
|
|
|
|
Assigns a role to a user
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"name": "string",
|
|
"communityId": "string",
|
|
"userId": "string"
|
|
}
|
|
```
|
|
|
|
## POST /api/v1/role/{id}/unassign
|
|
|
|
_Requires an authorization header_
|
|
|
|
### Request:
|
|
|
|
```json
|
|
{
|
|
"userId": "string"
|
|
}
|
|
```
|
|
|
|
Unassigns a role from a user
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"name": "string",
|
|
"communityId": "string",
|
|
"userId": "string"
|
|
}
|
|
```
|
|
|
|
## DELETE /api/v1/role/{id}
|
|
|
|
_Requires an authorization header_
|
|
|
|
Removes a role with id = {id}
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"communityId": "string"
|
|
}
|
|
```
|