-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Description
Create an endpoint for admin to create roles for users within an organisation from the system. This endpoint will allow only admins to create roles within their organisation efficiently and securely.
Acceptance Criteria
- The endpoint should follow RESTful API standards.
- The operation should return the correct HTTP status code
- Success: 200 OK
- The response body should match the provided example.
- The API should be secure, ensuring only admin users can create user roles within an organisation.
- Create roles for users in an organisation
Endpoint: PUT /api/v1/organisations/{org_id}/users/{user_id}/role
Path parameters on the API
org_id => String.
user_id => String.
Request Body
{
"role": "string"
}
Successful Response
Status code: 200
{
"status": "string",
"message": "string",
"data": {
"user": "string",
"org": "string",
"role": "string"
}
}
Error Response
Status code: 401
Unauthenticated.
{
"status": "Unauthorized",
"message": "Not authenticated",
"status_code": 401
}
Status code: 403
User not a member of the organisation
{
"status": "Forbidden",
"message": "Don't have permission to access",
"status_code": 403
}
Status code: 400
User already added to organization.
{
"status": "Bad Request" ,
message: "User already added to organization",
"status_code": 400
}
Purpose
The purpose of this endpoint is to allow admins to assign roles to users within an organisation. This will help the admin limit access control to organisation resources.
Requirements
- The request user must be authenticated with jwt token to assign roles in an organisation
- The request user must have admin role to access the endpoint
Expected Outcome
- Successful implementation of the assign roles to users in organizations endpoint.
- An intuitive and secure way for admins to assign different roles to the users.
- Increased efficiency in assigning user roles and managing user roles.
- Improved admin experience by providing role assignment to users in an organisation.
Unit Testing
- Ensure the endpoint correctly identifies if the requesting user is signed in
- Ensure the endpoint correctly identifies if the requesting user is an admin
- Test the endpoint to correctly update a users role in an organisation.
Metadata
Metadata
Assignees
Labels
No labels