Update API and docs to account for non-billable promotions

What does this MR do and why?

This solves:

Most of the work for queueing members for administrator approval is done. This MR updates the API responses and API docs.

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.

Screenshots or screen recordings

N/A

How to set up and validate locally

Enable the feature

  1. Have an Ultimate License, and simulate Ultimate Self Managed setup (export GITLAB_SIMULATE_SAAS=0 gdk restart)
  2. Enable the Setting Gitlab::CurrentSettings.update!(enable_member_promotion_management: true)
  3. Enable the Feature Flag Feature.enable(:member_promotion_management)

Test API changes

  1. Go to your GDK, click your User avatar > Preferences
  2. On the left hand-side menu select Access Tokens
  3. Click on Add new token
    1. Add a name that can be useful for you later
    2. Expiration date is optional, if you leave it blank it'll expire 1 year from now
    3. Select api scope
    4. Click Create personal access token
    5. Copy the token. It'll be something like glpat-a_Bunch_Of_Characters
  4. Now make API requests against your GDK (my URL is https://gdk.test:3443, change it to match yours)
    1. Invitations API:
      1. Request:
         curl --request POST \
         --header "PRIVATE-TOKEN: glpat-a_Bunch_Of_Characters" \
         --data "user_id=1&access_level=30" \
         "https://gdk.test:3443/api/v4/groups/flightjs/invitations"
      2. Response:
         {"queued_users":{"username_1":"Request queued for administrator approval."}}
    2. Members API:
      1. POST Request (adding 1 member):
         curl --request POST \
         --header "PRIVATE-TOKEN: glpat-a_Bunch_Of_Characters" \
         --data "user_id=1&access_level=30" \
         "https://gdk.test:3443/api/v4/groups/flightjs/members"
      2. Response:
         {"message":{"username_1":"Request queued for administrator approval."}}
      3. POST Request (multiple members):
         curl --request POST \
         --header "PRIVATE-TOKEN: glpat-a_Bunch_Of_Characters" \
         --data "user_id=1,2&access_level=30" \
         "https://gdk.test:3443/api/v4/groups/flightjs/members"
      4. Response:
         {
           "queued_users": {
             "username_1": "Request queued for administrator approval.",
             "username_2": "Request queued for administrator approval."
           },
           "status": "success"
         }
      5. PUT Request (changing a member role):
         curl --request PUT \
         --header "PRIVATE-TOKEN: glpat-a_Bunch_Of_Characters" \
         "https://gdk.test:3443/api/v4/groups/flightjs/members/1?access_level=30"
      6. Response:
         {"message":{"username_1":"Request queued for administrator approval."}}

API responses when the feature is disabled

The API will behave the same way as we currently have in production

  1. Invitations API:
     {"status":"success"}
  2. Members API:
    1. POST Request (adding 1 member):
        {
          "id": 1,
          "username": "guest-user",
          "name": "Guest  User",
          "state": "active",
          "locked": false,
          "avatar_url": "https://secure.gravatar.com/avatar/866d69548c964eca5d3d7bb1098e0842789b38e1c57b2f10a6c5bfe1d22b71c3?s=80\u0026d=identicon",
          "web_url": "https://gdk.test:3443/guest-user",
          "access_level": 30,
          "created_at": "2024-09-24T16:32:39.193Z",
          "created_by": {
            "id": 69,
            "username": "sheldonled",
            "name": "Sheldon Led",
            "state": "active",
            "locked": false,
            "avatar_url": "https://secure.gravatar.com/avatar/d72fd8312645f293d485dfb87a50828c261e535357b6fe4bf4886332db33cd1a?s=80\u0026d=identicon",
            "web_url": "https://gdk.test:3443/sheldonled"
          },
          "expires_at": null,
          "membership_state": "active"
        }
    2. POST Request (multiple members):
       {"status":"success"}
    3. PUT Request (changing a member role):
        {
          "id": 1,
          "username": "guest-user",
          "name": "Guest User",
          "state": "active",
          "locked": false,
          "avatar_url": "https://secure.gravatar.com/avatar/866d69548c964eca5d3d7bb1098e0842789b38e1c57b2f10a6c5bfe1d22b71c3?s=80\u0026d=identicon",
          "web_url": "https://gdk.test:3443/guest-user",
          "access_level": 30, <---------------------------- The new access level
          "created_at": "2024-09-24T16:29:03.930Z",
          "created_by": {
            "id": 69,
            "username": "sheldonled",
            "name": "Sheldon Led",
            "state": "active",
            "locked": false,
            "avatar_url": "https://secure.gravatar.com/avatar/d72fd8312645f293d485dfb87a50828c261e535357b6fe4bf4886332db33cd1a?s=80\u0026d=identicon",
            "web_url": "https://gdk.test:3443/sheldonled"
          },
          "expires_at": null,
          "membership_state": "active"
        }
Edited by Sheldon Led

Merge request reports

Loading