Skip to content

Disable group creation if unverified account is over limit

What does this MR do and why?

Currently, user accounts that are unverified can create an unlimited number of groups. We want to restrict this to a lower number, for example a max 2 of groups for an unverified account. If the user tries to create a group once they're over this limit, we want to show an error alert on the create group view:

ksnip_20240412-165842

This MR adds in the error alert. Note that the backend for this check is not ready yet, so this frontend work is just to get the alert in place so that it's already available when the backend work is completed.

How to set up and validate locally

Because backend is not ready yet, the data has been hard-coded to not show the alert. To change it to show the alert, apply this patch:

Patch
Index: app/helpers/groups_helper.rb
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
--- a/app/helpers/groups_helper.rb	(revision 2d6aa83cdede98a4be1573b8b1fdd1c615517a0c)
+++ b/app/helpers/groups_helper.rb	(date 1713399978933)
@@ -178,8 +178,8 @@
       parent_group_name: group.parent&.name,
       import_existing_group_path: new_group_path(parent_id: group.parent_id, anchor: 'import-group-pane'),
       is_saas: Gitlab.com?.to_s,
-      identity_verification_required: false.to_s,
-      identity_verification_path: '#'
+      identity_verification_required: true.to_s,
+      identity_verification_path: 'some/link/here'
     }
   end
  1. Open up the sidebar, click on the + icon, then click on New group.
  2. Click on Create group. Verify that the error alert is shown.
  3. Go back in your brower and click on Import group. Verify that the error alert is shown.

Related to https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/651

Edited by Daniel Tian

Merge request reports