Skip to content

Update billed_shared_group_members

Hinam Mehra requested to merge 443369-update-billed-shared-group-users into master

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

  1. Make you are on an Ultimate license and you have SaaS mode on with:
export GITLAB_SIMULATE_SAAS=1
gdk restart
  1. Create two private groups - QA group & Frontend group

  2. 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>)
  1. Add any 4 members to the QA group with the roles - Guest, Guest basic, Guest elevated, Developer, Developer Lead
  2. Then, navigate to the members page of the Frontend group and invite QA 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
  1. Each time, the number of billable users should match the expected outcome in #443369 (comment 2045035173)

Related to #443369

Edited by Hinam Mehra

Merge request reports

Loading