Skip to content

Update group#shared_externally to include projects

Vijay Hawoldar requested to merge vij-externally-shared-projects into master

What does this MR do and why?

In !75906 (diffs) we added a new method to detect if a group or it's subgroups have been shared externally (outside the namespace hierarchy), so that we can check if the SaaS User Cap feature can be used or not (cannot be used if shared externally)

This MR adds a new condition to include a group's projects in that method.

We need to do this because if a project is shared externally to the namespace hierarchy, the group members that have effectively been invited are considered billable, so we need to restrict the User Cap setting for that too.

Please note that we already have a follow up issue (https://gitlab.com/gitlab-org/gitlab/-/issues/349955) for monitoring and improving this method performance in future, and another (https://gitlab.com/gitlab-org/gitlab/-/issues/349895) for considering the expires_at and access_level

Docs are in-progress here: !77567 (merged)

Refs #342227 (closed)

How to set up and validate locally

  1. Setup a root group, e.g. Group A

  2. Setup another root group, e.g. Group X

  3. Add a project to Group A, Project 1

  4. Check the method:

    group_a.shared_externally?
    
    => false
  5. Invite Group X to Project 1 via Project Information > Members > Invite a group

  6. Re-check the method:

    group_a.shared_externally?
    
    => true

These steps can be re-checked with a subgroup project for the same results.

Please note that due to the use of strong_memoize, you may need to re-fetch the group when checking the method in a console.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vijay Hawoldar

Merge request reports