diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 5aa7abed22ce50bec61be611266752e6a12d61f5..ec4fbdec73a32f28f741be95eb4f8161da81de36 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -488,7 +488,7 @@ def self.kroki_formats_attributes validates :invisible_captcha_enabled, inclusion: { in: [true, false], message: N_('must be a boolean value') } - validates :invitation_flow_enforcement, :can_create_group, :user_defaults_to_private_profile, + validates :invitation_flow_enforcement, :can_create_group, :allow_project_creation_for_guest_and_below, :user_defaults_to_private_profile, allow_nil: false, inclusion: { in: [true, false], message: N_('must be a boolean value') } diff --git a/db/migrate/20231108093031_add_allow_project_creation_for_guest_and_below_to_application_settings.rb b/db/migrate/20231108093031_add_allow_project_creation_for_guest_and_below_to_application_settings.rb new file mode 100644 index 0000000000000000000000000000000000000000..06e0a7fc00020585ea234dfbb913dc656b2b014f --- /dev/null +++ b/db/migrate/20231108093031_add_allow_project_creation_for_guest_and_below_to_application_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddAllowProjectCreationForGuestAndBelowToApplicationSettings < Gitlab::Database::Migration[2.2] + milestone '16.6' + + def change + add_column(:application_settings, :allow_project_creation_for_guest_and_below, :boolean, default: true, null: false) + end +end diff --git a/db/schema_migrations/20231108093031 b/db/schema_migrations/20231108093031 new file mode 100644 index 0000000000000000000000000000000000000000..d532e469d821de33c01204617c25f4cf964e9667 --- /dev/null +++ b/db/schema_migrations/20231108093031 @@ -0,0 +1 @@ +fea17e6126f21671a8836dea252e2bd655179aeb6c746b6bbecaed0580dd255a \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 8582b819febac1828ef36c8f5c995efa28acc2bf..e6ba10056c409379aecd17cd5154d2e4c98ae008 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -12120,6 +12120,7 @@ CREATE TABLE application_settings ( math_rendering_limits_enabled boolean DEFAULT true NOT NULL, service_access_tokens_expiration_enforced boolean DEFAULT true NOT NULL, enable_artifact_external_redirect_warning_page boolean DEFAULT true NOT NULL, + allow_project_creation_for_guest_and_below boolean DEFAULT true NOT NULL, CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)), CONSTRAINT app_settings_container_registry_pre_import_tags_rate_positive CHECK ((container_registry_pre_import_tags_rate >= (0)::numeric)), CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)), diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index 59701f52f28c7fbc927ce0176e43a32d8183b4e6..f2f79311fdf8dfcbde65a887e7a0122401899962 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -162,6 +162,8 @@ it { is_expected.to validate_inclusion_of(:user_defaults_to_private_profile).in_array([true, false]) } + it { is_expected.to validate_inclusion_of(:allow_project_creation_for_guest_and_below).in_array([true, false]) } + it { is_expected.to validate_inclusion_of(:deny_all_requests_except_allowed).in_array([true, false]) } it 'ensures max_pages_size is an integer greater than 0 (or equal to 0 to indicate unlimited/maximum)' do