Update group#shared_externally to include projects
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
-
Setup a root group, e.g.
Group A
-
Setup another root group, e.g.
Group X
-
Add a project to
Group A
,Project 1
-
Check the method:
group_a.shared_externally? => false
-
Invite
Group X
toProject 1
viaProject Information > Members > Invite a group
-
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.
-
I have evaluated the MR acceptance checklist for this MR.