Skip to content

Add API to change membership state

Nicolas Dular requested to merge nd/billable-member-state-api into master

What does this MR do and why?

This API will be used for the Usage Quota page to toggle the membership state on free groups. It changes the membership states for all related memberships of a user to the given group to either active or awaiting.

It will be used to implement the toggle for https://gitlab.com/gitlab-org/gitlab/-/issues/352638

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

  1. Get an access token http://localhost:3000/-/profile/personal_access_tokens
  2. Start the gdk with
    export GITLAB_SIMULATE_SAAS=1
    gdk start
  3. Find a group that you want to experiment with - make sure that the Group has a free or default plan
    g = Group.find(153)
  4. Execute the curl request for a user within the group
     curl --request PUT --header "PRIVATE-TOKEN: TOKEN" "http://localhost:3000/api/v4/groups/GROUP_ID/billable_members/USER_ID/activate"
    
     curl --request PUT --header "PRIVATE-TOKEN: TOKEN" "http://localhost:3000/api/v4/groups/GROUP_ID/billable_members/USER_ID/deactivate"

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

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Nicolas Dular

Merge request reports