Added Promotion Management for CreatorService
Context
- As part of &13328 we are working on Adding controls for Admins/Owners to manage Billable Members promotion/addition in Groups and Projects (still a WIP feature).
- This issue deals with adding that Promotion control for the Invite New Member flow.
- When PromotionManagement conditions are applicable(code)(primarily when user is non-billable and the current change would make them billable), we want to queue the User/Member Addition/Promotion request if that addition/promotion will increase the Billable count for the SM instance (We will bring this to SaaS eventually)
- This would mean queuing that request in a MemberApprovals table
- Allowing Admin to view the requests and approve/reject it (being handled in different issues)
What does this MR do and why?
PS: This is a SelfManaged feature, and is still in development(WIP), so the feature-flag and settings for the feature is disabled by default.
This MR is part of a wider change, broken down for ease of review | |
---|---|
Database changes + Model Changes to Queue Member Approvals | !154552 (merged) |
Adds Finder to allow querying Nonbillable Users to be queued for promotion | !154555 (merged) (in review) |
Modifies existing Service to allow queuing Invited Members, (we have used the above two here) | !156801 (merged) (in review) |
Call the service modified above through Creator Service add_members method | <---- You are here |
This MR is built on top of the previous !154555 (merged) (in review MR), so the diff is setup against this MR for review :
- Uses the refactored QueueExistingMemberService now QueueNonBillableToBillableService in Creator Service:
EE: true Changelog: changed
ref: #433179 (closed)
How to setup and validate locally?
- Have an Ultimate License, and simulate Ultimate Self Managed setup (
export GITLAB_SIMULATE_SAAS=0
) - Enable Setting
setting = ApplicationSetting.first; setting.enable_member_promotion_management=true; setting.save!
- Enable FF
Feature.enable(:member_promotion_management)
- Create promotion requests for a new user:
- Visit any Group as an owner of that group (e.g.
http://127.0.0.1:3000/groups/gitlab-org/-/group_members
) - try Inviting a non-billable GUEST user to a DEVELOPER role (this user should be non-billable on the whole instance, i.e. have a highest role as guest, see !149094 (comment 1869616221) for details)
- You should see an Error in the Invitation Banner "Request Queued For Admin Approval." — this means a promotion request has been created, and the Invitation did not go through.
- Visit any Group as an owner of that group (e.g.
- Update an existing user of the group:
- Through the Invite modal Inviting a non-billable GUEST member to a DEVELOPER role (this member should be non-billable on the whole instance)
- Press Invite. You should see an Error in the Invitation Banner "Request Queued For Admin Approval." — this means a promotion request has been created, and the Invitation did not go through.
Edited by Suraj Tripathi