[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:
- API exists and member count can be retrieved by a member of the group as well as member of entitlements users.
- Additional optional parameter, Role should the count returned. Member/Owner or total count.
- If either of the membership is not present, it should give 401.
- The access validations should be consistent with List Member API.
- Unit tests are added for ~100% code coverage for the new code added
- Integration tests are added and are running in the pipeline
- Pipeline is running/pass with the same state as that of master.
- Tutorial section update here https://community.opengroup.org/osdu/platform/security-and-compliance/entitlements/-/blob/master/docs/tutorial/Entitlements-Service.md?ref_type=heads
- 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 by Deepa Kumari