Seats limitation removed from service account creation

What does this MR do and why?

This MR is in continuation for MR !216841 (merged) . I have the changes behind Feature flag as per discussion here - !216841 (comment 2972047202) .

I introduced a new Feature flag

allow_unlimited_service_account_for_trials

If enabled - This will allow creation of Service account users unlimited for Trial subscription

If disabled - This will stop the creation of Service account users limited to 100 users . Please note we are still allowing creation of SErvice account users as unlimited for Premium kind of subscription The Feature flag is only for trial subscriptions

@adil.farrukh for reference ⬆️

Solves https://gitlab.com/gitlab-org/gitlab/-/work_items/583474

How to set up and validate locally

  1. Check the subscription for your group

    group = Group.find_by_name(<groupn_name>)
    group_subscription = group.gitlab_subscription
  2. Fetch the number of seats against the subscription and update it to a small number

    seats = group_subscription.seats
    group_subscription.update!(seats: 2) 
  3. For Group level Service account first make sure your gdk instance is running SAAS mode -

    1. Create the service account users equal to the number of seats using api - https://docs.gitlab.com/api/service_accounts/#create-a-group-service-account and try creating one more than the seat count
      ```
      curl --request POST --header "PRIVATE-TOKEN: <token_value>" "https://gdk.test:3443/api/v4/groups/<group_id>/service_accounts" --data "email=SA34_8@example.com"
      ```
  4. You should be able to create a service account for the group.

Edited by Smriti Garg

Merge request reports

Loading