Update billed_shared_group_members
What does this MR do and why?
- This MR updates the number of billed users when a custom role is assigned to an invited group
- The acceptance criteria is listed in #443369 (comment 2045824094)
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
- Make you are on an Ultimate license and you have SaaS mode on with:
export GITLAB_SIMULATE_SAAS=1
gdk restart
-
Create two private groups -
QA group
&Frontend group
-
In the rails console, create custom roles:
# enable feature-flag
Feature.enable(:assign_custom_roles_to_group_links_saas)
# create member roles in both QA group and Frontend group
MemberRole.create(base_access_level: 10, name: "Guest basic", read_code: true, namespace_id: <FRONTEND_GROUP_ID>)
MemberRole.create(base_access_level: 10, name: "Guest basic", read_code: true, namespace_id: <QA_GROUP_ID>)
MemberRole.create(base_access_level: 10, name: "Guest elevated", read_vulnerability: true, namespace_id: <FRONTEND_GROUP_ID>)
MemberRole.create(base_access_level: 10, name: "Guest elevated", read_vulnerability: true, namespace_id: <QA_GROUP_ID>)
MemberRole.create(base_access_level: 30, name: "Developer Lead", read_vulnerability: true, admin_vulnerability: true, namespace_id: <FRONTEND_GROUP_ID>)
MemberRole.create(base_access_level: 30, name: "Developer Lead", read_vulnerability: true, admin_vulnerability: true, namespace_id: <QA_GROUP_ID>)
- Add any 4 members to the
QA group
with the roles -Guest
,Guest basic
,Guest elevated
,Developer
,Developer Lead
- Then, navigate to the members page of the
Frontend group
and inviteQA group
with different max roles -Guest
,Guest basic
,Guest elevated
,Developer
,Developer Lead
. Each time you change the role, check the number of billed users in the rails console:
group = Group.find_by(name: 'Frontend group')
::Namespaces::BilledUsersFinder.new(group, exclude_guests: true).execute
- Each time, the number of billable users should match the expected outcome in #443369 (comment 2045035173)
Related to #443369
Edited by Hinam Mehra