Allow group transfers to go over free user cap
What does this MR do and why?
Allow group transfers to go over the free user cap limit when the group/subgroup-to-be-tranferred qualifies for free user cap. See issue this is solving in #417728 (closed) and the reproduction steps below.
We needed to fix the issue of a transferred group being owner-less in conditions described in #417728 (closed) and detailed in the approach to fix that in #417728 (comment 1467451207)
Approach in this MR was to be as targeted as possible to ee
only(where free user cap exists) and SaaS(by checking free user cap eligibility). This enables us to explain-through-code to future readers of the code why this was done a bit better and keeps us from leaking ee
concerns into foss or non group member areas.
Screenshots or screen recordings
page | Before | After |
---|---|---|
redirection after clicking transfer as non-admin | ||
group members page after transfer as admin(or non admin for after) |
How to set up and validate locally
- Enable free user cap and free user cap on new namespaces in
bundle exec rails c
Feature.enable(:free_user_cap) Feature.enable(:free_user_cap_new_namespaces)
- Setup initial application settings in
bundle exec rails c
(false initially so we can get over the user cap limit)ApplicationSetting.first.update(dashboard_limit_enabled: false, dashboard_limit: 5, dashboard_enforcement_limit: 5)
- Simulate Saas and restart GDK
- Log in as a non-admin(admin could be used too, but will not see the
not-found
page on transfer which is ok, would then just have to validate members on the transferred group) - Create a new top-level private group
- Create a private subgroup in that group.
- Go to the members page of that subgroup and in the search switch to searching for direct membership type.
- Remove the only direct membership there(should be your logged in account)
- Go back to that subgroup and verify there are no more direct memberships(should be an inherited one of your logged in account)
- Create a new private project in that subgroup. Note: Visibility of private shouldn't matter here, just doing that here to match group.
- Add at least 6 members to that project(can be any role).
- Turn on the free user cap in the application settings in
bundle exec rails c
.ApplicationSetting.first.update(dashboard_limit_enabled: true)
- Reload the page and verify you see the danger alert on the subgroup level. Note: this may take a few minutes to destroy cache and become effective.
- On the subgroup, go to the > Settings -> General -> Advanced -> Transfer Group
- In
Select parent group
, selectNo parent group
and clickTransfer group
- On the newly tranferred-to-top-level group, go to the group members and verify your logged in account is a owner and that you see the read-only danger alert about being over free user limit.
- Compare this experience to master branch if desired(should see the
not-found
page as a non admin after clickingTransfer group
and as admin you'd have access to the subgroup and could verify there are no group members on the newly transferred group)
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.
Related to #417728 (closed)