Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: ASSIGN ROLES TO USERS WITHIN AN ORGANISATION #690

Open
15 tasks
STARKthegreat opened this issue Feb 28, 2025 · 0 comments
Open
15 tasks

FEAT: ASSIGN ROLES TO USERS WITHIN AN ORGANISATION #690

STARKthegreat opened this issue Feb 28, 2025 · 0 comments

Comments

@STARKthegreat
Copy link

STARKthegreat commented Feb 28, 2025

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.
@STARKthegreat STARKthegreat changed the title FEAT: Create a new team member FEAT: CREATE ROLES WITHIN AN ORGANISATION Feb 28, 2025
@STARKthegreat STARKthegreat changed the title FEAT: CREATE ROLES WITHIN AN ORGANISATION FEAT: ASSIGN ROLES TO USERS WITHIN AN ORGANISATION Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant