[ADR] API end point to get members count for a particular group

Status

  • Proposed
  • Trialing
  • Under review
  • Approved
  • Retired

Context & Scope

This ADR is about getting the members count of a particular group. Though we can count the number of members once we get a list of members We still need GetCount api because we don't want UI to count the number for so many groups all the time. It will result in a sluggish experience.

GET https://{{HOST}}/api/entitlements/v2/groups/:group_email/membersCount
Path variable - group_email.
Header - partition ID
Optional Parameter - Role
response 

{
    "groupEmail": "abc@xyx.xom",
    "membersCount": 12345
}
The requester must be a member of group service.entitlements.user.  All response codes would be as per the current standard in OSDU
validation - validate single partition ID and validate group email belonging to partition.

Trade-off Analysis

This endpoint would directly respond with the members/owners count for a particular group. currently, it requires additional coding on the UI side to count from the list and then put a total.

Decision

Just implement a simple API endpoint that would return members/owners count along with group email to identify the group.

Definition of Done:

  1. API exists and member count can be retrieved by a member of the group as well as member of entitlements users.
  2. Additional optional parameter, Role should the count returned. Member/Owner or total count.
  3. If either of the membership is not present, it should give 401.
  4. The access validations should be consistent with List Member API.
  5. Unit tests are added for ~100% code coverage for the new code added
  6. Integration tests are added and are running in the pipeline
  7. Pipeline is running/pass with the same state as that of master.
  8. Tutorial section update here https://community.opengroup.org/osdu/platform/security-and-compliance/entitlements/-/blob/master/docs/tutorial/Entitlements-Service.md?ref_type=heads
  9. API doc update here https://community.opengroup.org/osdu/platform/security-and-compliance/entitlements/-/blob/master/docs/api/entitlements_openapi.yaml?ref_type=heads
Edited Jan 17, 2024 by Deepa Kumari
Assignee Loading
Time tracking Loading