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]: Get Members of an Organisation #691

Open
Valleon6 opened this issue Feb 28, 2025 · 0 comments
Open

[FEAT]: Get Members of an Organisation #691

Valleon6 opened this issue Feb 28, 2025 · 0 comments

Comments

@Valleon6
Copy link

Description
Implement an endpoint to retrieve members of an organisation based on the organisation's ID. The response should be paginated and include relevant user details.

Acceptance Criteria

Users can retrieve the list of members in an organisation by providing the org_id.
The request should support pagination using page and page_size query parameters.
If the organisation exists and the requester is authorized, return a paginated list of members.
If the requester is not a member of the organisation, return a 403 Forbidden response.
If the organisation is not found, return a 404 Not Found response.

Purpose
This feature is needed to enable authorized users to view the members of a specific organisation. It ensures proper access control while providing paginated data for better performance and usability.

Requirements
The endpoint should enforce authentication and authorization checks to ensure only members can access the data.
The response should follow a structured JSON format, including status_code, data, and message fields.
Pagination should be implemented using page and page_size query parameters.
Proper error handling should be implemented for unauthorized access and missing organisations.

API Endpoint

  1. Get Organisation Members

Endpoint: GET /api/v1/organisations/{org_id}/users
Description: Retrieves a paginated list of members belonging to the specified organisation.
Path Parameters:
org_id (string, required): The unique identifier of the organisation.

Query Parameters:
page (number, required): The page number for pagination.
page_size (number, required): The number of users to return per page.

Responses
200 OK – Successfully retrieved the list of members.
Response Example:

{
"status_code": 200,
"data": [
{
"user_id": "12345",
"name": "John Doe",
"email": "[email protected]",
"role": "Admin"
},
{
"user_id": "67890",
"name": "Jane Smith",
"email": "[email protected]",
"role": "Member"
}
],
"message": "Organisation members retrieved successfully."
}

403 Forbidden – The user is not a member of the organisation.
Response Example:

{
"status_code": 403,
"message": "You are not authorized to view members of this organisation."
}

404 Not Found – The organisation does not exist.
Response Example:

{
"status_code": 404,
"message": "Organisation not found."
}

Expected Outcome

  • Authorized users can retrieve a paginated list of members within an organisation.
  • Unauthorized users cannot access the endpoint.
  • Organisations that do not exist will return a 404 response.
  • The system maintains performance efficiency by using pagination.
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