Skip to content

Add a setting to allow/disallow creation of organizations

What does this MR do and why?

See the blueprint to understand more about Organization that is being built by grouptenant scale https://docs.gitlab.com/ee/architecture/blueprints/organization/.

Adds a new column to the application_settings table to store the setting in the admin area that can allow or disallow the creation of organizations by the users.

Migration output

Up
bin/rails db:migrate
main: == [advisory_lock_connection] object_id: 184540, pg_backend_pid: 45454
main: == 20231114100444 AddCanCreateOrganizationToApplicationSettings: migrating ====
main: -- add_column(:application_settings, :can_create_organization, :boolean, {:default=>true, :null=>false})
main:    -> 0.0073s
main: == 20231114100444 AddCanCreateOrganizationToApplicationSettings: migrated (0.0120s)

main: == [advisory_lock_connection] object_id: 184540, pg_backend_pid: 45454
ci: == [advisory_lock_connection] object_id: 184800, pg_backend_pid: 45458
ci: == 20231114100444 AddCanCreateOrganizationToApplicationSettings: migrating ====
ci: -- add_column(:application_settings, :can_create_organization, :boolean, {:default=>true, :null=>false})
ci:    -> 0.0096s
ci: == 20231114100444 AddCanCreateOrganizationToApplicationSettings: migrated (0.0207s)

ci: == [advisory_lock_connection] object_id: 184800, pg_backend_pid: 45458
Down
bin/rails db:migrate:down:ci VERSION=20231114100444 && bin/rails db:migrate:down:main VERSION=20231114100444
ci: == [advisory_lock_connection] object_id: 184220, pg_backend_pid: 21322
ci: == 20231114100444 AddCanCreateOrganizationToApplicationSettings: reverting ====
ci: -- remove_column(:application_settings, :can_create_organization, :boolean, {:default=>true, :null=>false})
ci:    -> 0.0019s
ci: == 20231114100444 AddCanCreateOrganizationToApplicationSettings: reverted (0.0123s)

ci: == [advisory_lock_connection] object_id: 184220, pg_backend_pid: 21322
main: == [advisory_lock_connection] object_id: 184200, pg_backend_pid: 21740
main: == 20231114100444 AddCanCreateOrganizationToApplicationSettings: reverting ====
main: -- remove_column(:application_settings, :can_create_organization, :boolean, {:default=>true, :null=>false})
main:    -> 0.0019s
main: == 20231114100444 AddCanCreateOrganizationToApplicationSettings: reverted (0.0066s)

main: == [advisory_lock_connection] object_id: 184200, pg_backend_pid: 21740

Screenshots or screen recordings

Before After
image image

How to set up and validate locally

  1. On the left sidebar, select Search or go to.
  2. Select Admin Area.
  3. Select Settings > General.
  4. Expand Account and limit.
  5. Clear the Allow users to create organizations checkbox.
  6. Ability.allowed?(User.first, :create_organization) in rails console should give false.
  7. Now check the above checkbox and the above command should return true.

MR acceptance checklist

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

Related to #423302 (closed)

Edited by Abdul Wadood

Merge request reports