Skip to content

Add indirect memberships REST endpoint

Vijay Hawoldar requested to merge vij-invited-memberships into master

What does this MR do and why?

Adds a new API endpoint for returning the indirect memberships to a root group, for a given billable user.

This new endpoint acts as a counterpart to the existing memberships endpoint which returns direct memberships.

The new endpoint will be used by the frontend to populate which groups the user is a member of that that has been invited/shared, as shown in the design: #351954[MVC.png]

Refs #386583 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. Create a top level Group, e.g. Group A
  2. Create another top level Group, e.g. Group B
  3. Add a user to Group A (http://gdk.test:3000/group-a/-/group_members)
  4. Add the same user to Group B (http://gdk.test:3000/group-b/-/group_members)
  5. Invite Group B to Group A
  6. Query the existing memberships endpoint and you should only see the membership for the user to Group A:
      curl --request GET \
        --url http://gdk.test:3000/api/v4/groups/<Group-A-ID>/billable_members/<User-ID>/memberships/ \
        --header 'PRIVATE-TOKEN: YOURTOKEN' 
  7. Query the new indirect memberships endpoint and you should only see the membership for the user to Group B:
      curl --request GET \
        --url http://gdk.test:3000/api/v4/groups/<Group-A-ID>/billable_members/<User-ID>/indirect \
        --header 'PRIVATE-TOKEN: YOURTOKEN' 

Numbered steps to set up and validate the change are strongly suggested.

Edited by Vijay Hawoldar

Merge request reports