diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index ecc64da20981c0950dee6442092b4d023f067ad5..2519db825c0f27bcdfbc5f6bc61c4fe79d25c3c1 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -24,6 +24,8 @@ class UserPreference < ApplicationRecord allow_blank: true validates :use_legacy_web_ide, allow_nil: false, inclusion: { in: [true, false] } + validates :pass_user_identities_to_ci_jwt, allow_nil: false, inclusion: { in: [true, false] } + validates :pinned_nav_items, json_schema: { filename: 'pinned_nav_items' } ignore_columns :experience_level, remove_with: '14.10', remove_after: '2021-03-22' diff --git a/db/migrate/20230406134436_add_identity_toggle_to_user_preferences.rb b/db/migrate/20230406134436_add_identity_toggle_to_user_preferences.rb new file mode 100644 index 0000000000000000000000000000000000000000..0b7fcceb3ee219b1c2084a49cece58e2cbeb0d79 --- /dev/null +++ b/db/migrate/20230406134436_add_identity_toggle_to_user_preferences.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddIdentityToggleToUserPreferences < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + add_column :user_preferences, :pass_user_identities_to_ci_jwt, :boolean, default: false, null: false + end +end diff --git a/db/schema_migrations/20230406134436 b/db/schema_migrations/20230406134436 new file mode 100644 index 0000000000000000000000000000000000000000..17d51bba6ce68ab41d8560b9e34a289c8fd9638e --- /dev/null +++ b/db/schema_migrations/20230406134436 @@ -0,0 +1 @@ +3b7a512959c9d109ee4b454693ebfafed624869c82fa64d92b3f780165e91feb \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index a09543d9a578574bd1313d1e2f3ecbe85878926d..ab6a82471a928aa430b270cdd16f0c4dfdc0e518 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -23382,6 +23382,7 @@ CREATE TABLE user_preferences ( use_new_navigation boolean, achievements_enabled boolean DEFAULT true NOT NULL, pinned_nav_items jsonb DEFAULT '{}'::jsonb NOT NULL, + pass_user_identities_to_ci_jwt boolean DEFAULT false NOT NULL, CONSTRAINT check_89bf269f41 CHECK ((char_length(diffs_deletion_color) <= 7)), CONSTRAINT check_d07ccd35f7 CHECK ((char_length(diffs_addition_color) <= 7)) ); diff --git a/spec/models/user_preference_spec.rb b/spec/models/user_preference_spec.rb index a6f64c90657ece23d7dec88324a42905f44192dc..5c368b1632b33a1d649a7493bcf4a65234eb7454 100644 --- a/spec/models/user_preference_spec.rb +++ b/spec/models/user_preference_spec.rb @@ -54,6 +54,13 @@ it { is_expected.not_to allow_value(nil).for(:use_legacy_web_ide) } it { is_expected.not_to allow_value("").for(:use_legacy_web_ide) } end + + describe 'pass_user_identities_to_ci_jwt' do + it { is_expected.to allow_value(true).for(:pass_user_identities_to_ci_jwt) } + it { is_expected.to allow_value(false).for(:pass_user_identities_to_ci_jwt) } + it { is_expected.not_to allow_value(nil).for(:pass_user_identities_to_ci_jwt) } + it { is_expected.not_to allow_value("").for(:pass_user_identities_to_ci_jwt) } + end end describe 'notes filters global keys' do