-
Notifications
You must be signed in to change notification settings - Fork 1
Role Management API
M♢NTΛSIM edited this page Aug 17, 2024
·
1 revision
-
POST
/roles
- Summary: Creates a new role with specified permissions. This endpoint requires admin permissions.
- Security: Bearer Authentication
-
Request Body:
-
Content-Type:
application/json
-
Schema:
{ "$ref": "#/components/schemas/Role" }
-
Content-Type:
-
Responses:
- 201 Created: Role created successfully.
- 400 Bad Request: Invalid data provided.
-
Tags:
- Role Management
-
GET
/roles
- Summary: Fetches a list of roles based on pagination and filters. Requires admin permissions.
- Security: Bearer Authentication
-
Parameters:
-
Query Parameter:
-
Name:
page
- Description: Page number of the roles list.
-
Schema:
{ "type": "integer" }
-
Name:
-
Query Parameter:
-
Name:
limit
- Description: Number of roles per page.
-
Schema:
{ "type": "integer" }
-
Name:
-
Query Parameter:
-
Responses:
-
200 OK:
- Description: A list of roles.
-
Content:
-
Content-Type:
application/json
-
Schema:
{ "type": "array", "items": { "$ref": "#/components/schemas/Role" } }
-
Content-Type:
- 404 Not Found: No roles found.
-
200 OK:
-
Tags:
- Role Management
-
DELETE
/roles
- Summary: Deletes roles based on a list of IDs provided in the request. Requires admin permissions.
- Security: Bearer Authentication
-
Request Body:
-
Content-Type:
application/json
-
Schema:
{ "type": "object", "properties": { "ids": { "type": "array", "items": { "type": "string" }, "description": "List of role IDs to delete." } } }
-
Content-Type:
-
Responses:
- 200 OK: Roles deleted successfully.
- 400 Bad Request: Invalid request format.
-
Tags:
- Role Management
-
POST
/roles/default
- Summary: Creates or updates the default role with all available permissions. Requires admin permissions.
- Security: Bearer Authentication
-
Responses:
- 201 Created: Default role created or updated successfully.
- 400 Bad Request: Failed to create or update the default role.
-
Tags:
- Role Management
-
GET
/roles/{roleId}
- Summary: Fetches a role by its ID. Requires admin permissions.
- Security: Bearer Authentication
-
Parameters:
-
Path Parameter:
-
Name:
roleId
- Description: The ID of the role to retrieve.
-
Schema:
{ "type": "string" }
-
Name:
-
Path Parameter:
-
Responses:
- 200 OK: Role retrieved successfully.
- 404 Not Found: Role not found.
-
Tags:
- Role Management
-
PUT
/roles/{roleId}
- Summary: Updates the specified role's details by ID. Requires admin permissions.
- Security: Bearer Authentication
-
Request Body:
-
Content-Type:
application/json
-
Schema:
{ "$ref": "#/components/schemas/Role" }
-
Content-Type:
-
Responses:
- 200 OK: Role updated successfully.
- 404 Not Found: Role not found.
-
Tags:
- Role Management
-
DELETE
/roles/{roleId}
- Summary: Deletes the specified role by its ID. Requires admin permissions.
- Security: Bearer Authentication
-
Responses:
- 200 OK: Role deleted successfully.
- 404 Not Found: Role not found.
-
Tags:
- Role Management
-
All Other Methods on
/roles
,/roles/default
, and/roles/{roleId}
- Summary: Handles unsupported methods for the respective endpoints.
-
Responses:
- 405 Method Not Allowed: Method not supported.
-
Tags:
- Role Management