From 72d097174b5ec397e2ee7c3afe0460fe41cca272 Mon Sep 17 00:00:00 2001 From: Rutger Wessels Date: Thu, 8 Aug 2024 13:48:00 +0200 Subject: [PATCH 1/4] Remove organization validation exception from Ldap::OmniauthCallbacksController --- app/controllers/ldap/omniauth_callbacks_controller.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/ldap/omniauth_callbacks_controller.rb b/app/controllers/ldap/omniauth_callbacks_controller.rb index 4c9439de780436..1c79bd3a668e12 100644 --- a/app/controllers/ldap/omniauth_callbacks_controller.rb +++ b/app/controllers/ldap/omniauth_callbacks_controller.rb @@ -22,9 +22,7 @@ def ldap return admin_mode_flow(Gitlab::Auth::Ldap::User) if current_user_mode.admin_mode_requested? end - Namespace.with_disabled_organization_validation do - sign_in_user_flow(Gitlab::Auth::Ldap::User) - end + sign_in_user_flow(Gitlab::Auth::Ldap::User) end define_providers! -- GitLab From 2bdf9d37c05c9d9cb11fb337933931f74889dbd4 Mon Sep 17 00:00:00 2001 From: Rutger Wessels Date: Thu, 8 Aug 2024 15:18:25 +0200 Subject: [PATCH 2/4] Remove organization validation exception from OmniauthController --- app/controllers/omniauth_callbacks_controller.rb | 6 ++---- ee/lib/ee/gitlab/auth/ldap/user.rb | 2 +- ee/lib/gitlab/auth/group_saml/user.rb | 3 ++- ee/lib/gitlab/auth/oidc/user.rb | 2 +- .../ee/omniauth_callbacks_controller_spec.rb | 2 +- .../groups/omniauth_callbacks_controller_spec.rb | 2 +- .../ldap/omniauth_callbacks_controller_spec.rb | 2 +- ee/spec/lib/gitlab/auth/group_saml/user_spec.rb | 3 ++- ee/spec/lib/gitlab/auth/ldap/user_spec.rb | 7 ++----- ee/spec/lib/gitlab/auth/oidc/user_spec.rb | 3 ++- ee/spec/lib/gitlab/auth/saml/user_spec.rb | 3 ++- .../ee/omniauth_callbacks_controller_spec.rb | 2 +- lib/gitlab/auth/o_auth/user.rb | 15 +++++++++------ .../omniauth_callbacks_controller_spec.rb | 4 ++-- spec/lib/gitlab/auth/atlassian/user_spec.rb | 3 ++- spec/lib/gitlab/auth/ldap/user_spec.rb | 3 ++- spec/lib/gitlab/auth/o_auth/user_spec.rb | 7 ++++--- spec/lib/gitlab/auth/saml/user_spec.rb | 3 ++- .../disable_namespace_organization_validation.yml | 4 ---- 19 files changed, 39 insertions(+), 37 deletions(-) diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index db99cda2a18011..d24a0f509525ab 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -165,9 +165,7 @@ def omniauth_flow(auth_module, identity_linker: nil) redirect_identity_exists end else - Namespace.with_disabled_organization_validation do - sign_in_user_flow(auth_module::User) - end + sign_in_user_flow(auth_module::User) end end @@ -200,7 +198,7 @@ def redirect_authorize_identity_link(identity_linker) def build_auth_user(auth_user_class) strong_memoize_with(:build_auth_user, auth_user_class) do - auth_user_class.new(oauth) + auth_user_class.new(oauth, { organization_id: Current.organization_id }) end end diff --git a/ee/lib/ee/gitlab/auth/ldap/user.rb b/ee/lib/ee/gitlab/auth/ldap/user.rb index ff9155c8f47bd5..8b2b626f030341 100644 --- a/ee/lib/ee/gitlab/auth/ldap/user.rb +++ b/ee/lib/ee/gitlab/auth/ldap/user.rb @@ -9,7 +9,7 @@ module Gitlab module Auth module Ldap module User - def initialize(auth_hash) + def initialize(auth_hash, user_params = {}) super set_external_with_external_groups diff --git a/ee/lib/gitlab/auth/group_saml/user.rb b/ee/lib/gitlab/auth/group_saml/user.rb index 787596b50d09f9..a5ca734f48e0c5 100644 --- a/ee/lib/gitlab/auth/group_saml/user.rb +++ b/ee/lib/gitlab/auth/group_saml/user.rb @@ -11,7 +11,8 @@ class User < Gitlab::Auth::OAuth::User attr_reader :auth_hash override :initialize - def initialize(auth_hash) + def initialize(auth_hash, user_params = {}) + @user_params = user_params @auth_hash = AuthHash.new(auth_hash) end diff --git a/ee/lib/gitlab/auth/oidc/user.rb b/ee/lib/gitlab/auth/oidc/user.rb index 16d2414a287da7..123f9bfbbe2b73 100644 --- a/ee/lib/gitlab/auth/oidc/user.rb +++ b/ee/lib/gitlab/auth/oidc/user.rb @@ -9,7 +9,7 @@ module Gitlab module Auth module Oidc class User < OAuth::User - def initialize(auth_hash) + def initialize(auth_hash, user_params = {}) provider_name = auth_hash.provider @oidc_config = Config.options_for(provider_name) diff --git a/ee/spec/controllers/ee/omniauth_callbacks_controller_spec.rb b/ee/spec/controllers/ee/omniauth_callbacks_controller_spec.rb index d030aacd596a1b..9a937cf661a069 100644 --- a/ee/spec/controllers/ee/omniauth_callbacks_controller_spec.rb +++ b/ee/spec/controllers/ee/omniauth_callbacks_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe OmniauthCallbacksController, type: :controller, feature_category: :system_access do +RSpec.describe OmniauthCallbacksController, :with_current_organization, type: :controller, feature_category: :system_access do include LoginHelpers let_it_be(:extern_uid) { 'my-uid' } diff --git a/ee/spec/controllers/groups/omniauth_callbacks_controller_spec.rb b/ee/spec/controllers/groups/omniauth_callbacks_controller_spec.rb index f34c623016632c..0f2c39366c7fd9 100644 --- a/ee/spec/controllers/groups/omniauth_callbacks_controller_spec.rb +++ b/ee/spec/controllers/groups/omniauth_callbacks_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Groups::OmniauthCallbacksController, :aggregate_failures, feature_category: :system_access do +RSpec.describe Groups::OmniauthCallbacksController, :with_current_organization, :aggregate_failures, feature_category: :system_access do include LoginHelpers include ForgeryProtection diff --git a/ee/spec/controllers/ldap/omniauth_callbacks_controller_spec.rb b/ee/spec/controllers/ldap/omniauth_callbacks_controller_spec.rb index e005636b2b8a54..ecbbe0f2bea64a 100644 --- a/ee/spec/controllers/ldap/omniauth_callbacks_controller_spec.rb +++ b/ee/spec/controllers/ldap/omniauth_callbacks_controller_spec.rb @@ -19,7 +19,7 @@ expect(flash[:notice]).to eq nil end - context 'for sign up', :aggregate_failures do + context 'for sign up', :with_current_organization, :aggregate_failures do let(:user) { build_stubbed(:user) } before do diff --git a/ee/spec/lib/gitlab/auth/group_saml/user_spec.rb b/ee/spec/lib/gitlab/auth/group_saml/user_spec.rb index 832905692cd47e..5edcad248f6549 100644 --- a/ee/spec/lib/gitlab/auth/group_saml/user_spec.rb +++ b/ee/spec/lib/gitlab/auth/group_saml/user_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' RSpec.describe Gitlab::Auth::GroupSaml::User, :aggregate_failures, feature_category: :system_access do + let_it_be(:organization) { create(:organization) } let(:uid) { '1234' } let(:saml_provider) { create(:saml_provider) } let(:group) { saml_provider.group } @@ -14,7 +15,7 @@ end subject(:oauth_user) do - oauth_user = described_class.new(auth_hash) + oauth_user = described_class.new(auth_hash, organization_id: organization.id) oauth_user.saml_provider = saml_provider oauth_user diff --git a/ee/spec/lib/gitlab/auth/ldap/user_spec.rb b/ee/spec/lib/gitlab/auth/ldap/user_spec.rb index be239e2bfa6be6..26ae1cf70b2452 100644 --- a/ee/spec/lib/gitlab/auth/ldap/user_spec.rb +++ b/ee/spec/lib/gitlab/auth/ldap/user_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Gitlab::Auth::Ldap::User do include LdapHelpers - let(:ldap_user) { described_class.new(auth_hash) } + let_it_be(:organization) { create(:organization) } + let(:ldap_user) { described_class.new(auth_hash, organization_id: organization.id) } let(:gl_user) { ldap_user.gl_user } let(:info) do { @@ -24,10 +25,6 @@ let(:external_groups) { [] } let!(:fake_proxy) { fake_ldap_sync_proxy(auth_hash.provider) } - around do |example| - Namespace.with_disabled_organization_validation { example.run } - end - before do allow(fake_proxy).to receive(:dns_for_group_cn).with(group_cn).and_return(group_member_dns) stub_ldap_config(external_groups: external_groups) diff --git a/ee/spec/lib/gitlab/auth/oidc/user_spec.rb b/ee/spec/lib/gitlab/auth/oidc/user_spec.rb index 86d0cc1c1dd333..94d2d39835dd33 100644 --- a/ee/spec/lib/gitlab/auth/oidc/user_spec.rb +++ b/ee/spec/lib/gitlab/auth/oidc/user_spec.rb @@ -3,7 +3,8 @@ require 'spec_helper' RSpec.describe Gitlab::Auth::Oidc::User, feature_category: :system_access do - let(:oidc_user) { described_class.new(auth_hash) } + let_it_be(:organization) { create(:organization) } + let(:oidc_user) { described_class.new(auth_hash, organization_id: organization.id) } let(:gl_user) { oidc_user.gl_user } let(:user_groups) { nil } diff --git a/ee/spec/lib/gitlab/auth/saml/user_spec.rb b/ee/spec/lib/gitlab/auth/saml/user_spec.rb index 862a5d9154457e..052dba883738cb 100644 --- a/ee/spec/lib/gitlab/auth/saml/user_spec.rb +++ b/ee/spec/lib/gitlab/auth/saml/user_spec.rb @@ -6,7 +6,8 @@ include LdapHelpers include LoginHelpers - let(:saml_user) { described_class.new(auth_hash) } + let(:organization) { create(:organization) } + let(:saml_user) { described_class.new(auth_hash, organization_id: organization.id) } let(:gl_user) { saml_user.gl_user } let(:uid) { 'my-uid' } let(:dn) { 'uid=user1,ou=people,dc=example' } diff --git a/ee/spec/requests/ee/omniauth_callbacks_controller_spec.rb b/ee/spec/requests/ee/omniauth_callbacks_controller_spec.rb index bb639a6d09694d..1afb1f64ddb68d 100644 --- a/ee/spec/requests/ee/omniauth_callbacks_controller_spec.rb +++ b/ee/spec/requests/ee/omniauth_callbacks_controller_spec.rb @@ -19,7 +19,7 @@ with_omniauth_full_host { example.run } end - context 'when user is not registered yet', :clean_gitlab_redis_sessions do + context 'when user is not registered yet', :with_current_organization, :clean_gitlab_redis_sessions do let(:user) { build_stubbed(:user, email: 'new@example.com') } let(:path) { '/user/return/to/path' } diff --git a/lib/gitlab/auth/o_auth/user.rb b/lib/gitlab/auth/o_auth/user.rb index ee0663ef0f8f19..e29981455a3bdb 100644 --- a/lib/gitlab/auth/o_auth/user.rb +++ b/lib/gitlab/auth/o_auth/user.rb @@ -29,8 +29,9 @@ def find_by_uid_and_provider(uid, provider) attr_reader :auth_hash - def initialize(auth_hash) + def initialize(auth_hash, user_params = {}) self.auth_hash = auth_hash + @user_params = user_params update_profile add_or_update_user_identities end @@ -57,9 +58,7 @@ def save(provider = protocol_name) block_after_save = needs_blocking? - Namespace.with_disabled_organization_validation do - Users::UpdateService.new(gl_user, user: gl_user).execute! - end + Users::UpdateService.new(gl_user, user: gl_user).execute! gl_user.block_pending_approval if block_after_save activate_user_if_user_cap_not_reached @@ -223,7 +222,10 @@ def find_by_uid_and_provider end def build_new_user(skip_confirmation: true) - user_params = user_attributes.merge(skip_confirmation: skip_confirmation) + user_params = user_attributes + .merge(skip_confirmation: skip_confirmation) + .merge(@user_params) + Users::AuthorizedBuildService.new(nil, user_params).execute end @@ -247,7 +249,8 @@ def user_attributes email: email, password: auth_hash.password, password_confirmation: auth_hash.password, - password_automatically_set: true + password_automatically_set: true, + organization_id: @user_params[:organization_id] } end diff --git a/spec/controllers/omniauth_callbacks_controller_spec.rb b/spec/controllers/omniauth_callbacks_controller_spec.rb index 07bb8df3cb2543..e0f5a112ea5d8b 100644 --- a/spec/controllers/omniauth_callbacks_controller_spec.rb +++ b/spec/controllers/omniauth_callbacks_controller_spec.rb @@ -92,7 +92,7 @@ end end - describe 'omniauth' do + describe 'omniauth', :with_current_organization do let(:user) { create(:omniauth_user, extern_uid: extern_uid, provider: provider) } let(:omniauth_email) { user.email } let(:additional_info) { {} } @@ -648,7 +648,7 @@ def stub_last_request_id(id) let(:post_action) { post :saml, params: { SAMLResponse: mock_saml_response } } end - context 'for sign up' do + context 'for sign up', :with_current_organization do before do user.destroy! end diff --git a/spec/lib/gitlab/auth/atlassian/user_spec.rb b/spec/lib/gitlab/auth/atlassian/user_spec.rb index 1db01102bc2c63..f2165a0281911a 100644 --- a/spec/lib/gitlab/auth/atlassian/user_spec.rb +++ b/spec/lib/gitlab/auth/atlassian/user_spec.rb @@ -3,7 +3,8 @@ require 'spec_helper' RSpec.describe Gitlab::Auth::Atlassian::User do - let(:oauth_user) { described_class.new(oauth) } + let_it_be(:organization) { create(:organization) } + let(:oauth_user) { described_class.new(oauth, organization_id: organization.id) } let(:gl_user) { oauth_user.gl_user } let(:extern_uid) { generate(:username) } let(:oauth) do diff --git a/spec/lib/gitlab/auth/ldap/user_spec.rb b/spec/lib/gitlab/auth/ldap/user_spec.rb index d635cfe0907646..0e3a6bac02a2ea 100644 --- a/spec/lib/gitlab/auth/ldap/user_spec.rb +++ b/spec/lib/gitlab/auth/ldap/user_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Gitlab::Auth::Ldap::User do include LdapHelpers - let(:ldap_user) { described_class.new(auth_hash) } + let(:organization) { create(:organization) } + let(:ldap_user) { described_class.new(auth_hash, organization_id: organization.id) } let(:gl_user) { ldap_user.gl_user } let(:info) do { diff --git a/spec/lib/gitlab/auth/o_auth/user_spec.rb b/spec/lib/gitlab/auth/o_auth/user_spec.rb index d56ea66b951fe0..580a11fe1d3778 100644 --- a/spec/lib/gitlab/auth/o_auth/user_spec.rb +++ b/spec/lib/gitlab/auth/o_auth/user_spec.rb @@ -5,8 +5,9 @@ RSpec.describe Gitlab::Auth::OAuth::User, feature_category: :system_access do include LdapHelpers - let(:oauth_user) { described_class.new(auth_hash) } - let(:oauth_user_2) { described_class.new(auth_hash_2) } + let_it_be(:organization) { create(:organization) } + let(:oauth_user) { described_class.new(auth_hash, organization_id: organization.id) } + let(:oauth_user_2) { described_class.new(auth_hash_2, organization_id: organization.id) } let(:gl_user) { oauth_user.gl_user } let(:gl_user_2) { oauth_user_2.gl_user } let(:uid) { 'my-uid' } @@ -83,7 +84,7 @@ nickname: 'jastrom' } special_hash = OmniAuth::AuthHash.new(uid: dn, provider: 'ldapmain', info: special_info) - special_chars_user = described_class.new(special_hash) + special_chars_user = described_class.new(special_hash, organization_id: organization.id) user = special_chars_user.save expect(described_class.find_by_uid_and_provider(dn, 'ldapmain')).to eq user diff --git a/spec/lib/gitlab/auth/saml/user_spec.rb b/spec/lib/gitlab/auth/saml/user_spec.rb index 599d55cdb832eb..f96c7fe0bc438a 100644 --- a/spec/lib/gitlab/auth/saml/user_spec.rb +++ b/spec/lib/gitlab/auth/saml/user_spec.rb @@ -6,7 +6,8 @@ include LdapHelpers include LoginHelpers - let(:saml_user) { described_class.new(auth_hash) } + let_it_be(:organization) { create(:organization) } + let(:saml_user) { described_class.new(auth_hash, organization_id: organization.id) } let(:gl_user) { saml_user.gl_user } let(:uid) { 'my-uid' } let(:dn) { 'uid=user1,ou=people,dc=example' } diff --git a/spec/support/helpers/disable_namespace_organization_validation.yml b/spec/support/helpers/disable_namespace_organization_validation.yml index 2e93c724fce167..5073522243d3cb 100644 --- a/spec/support/helpers/disable_namespace_organization_validation.yml +++ b/spec/support/helpers/disable_namespace_organization_validation.yml @@ -20,8 +20,6 @@ - ee/spec/features/registrations/start_trial_from_external_site_without_confirmation_spec.rb - ee/spec/features/trials/saas/creation_with_no_existing_namespace_flow_spec.rb - ee/spec/lib/gitlab/auth/group_saml/user_spec.rb -- ee/spec/lib/gitlab/auth/ldap/user_spec.rb -- ee/spec/lib/gitlab/auth/oidc/user_spec.rb - ee/spec/lib/gitlab/auth/saml/user_spec.rb - ee/spec/lib/ee/gitlab/scim/provisioning_service_spec.rb - ee/spec/lib/ee/gitlab/scim/group/provisioning_service_spec.rb @@ -33,7 +31,6 @@ - spec/controllers/admin/groups_controller_spec.rb - spec/controllers/admin/users_controller_spec.rb - spec/controllers/groups_controller_spec.rb -- spec/controllers/omniauth_callbacks_controller_spec.rb - spec/controllers/registrations_controller_spec.rb - spec/features/admin/admin_groups_spec.rb - spec/features/dashboard/group_spec.rb @@ -42,7 +39,6 @@ - spec/graphql/types/project_type_spec.rb - spec/lib/gitlab/auth/atlassian/user_spec.rb - spec/lib/gitlab/auth/ldap/user_spec.rb -- spec/lib/gitlab/auth/o_auth/user_spec.rb - spec/lib/gitlab/auth/saml/user_spec.rb - spec/models/hooks/system_hook_spec.rb - spec/requests/api/groups_spec.rb -- GitLab From 2d074f30482655cd86f45306f681a773312ac8ae Mon Sep 17 00:00:00 2001 From: Abdul Wadood Date: Wed, 21 Aug 2024 10:46:20 +0530 Subject: [PATCH 3/4] Use let_it_be for organization --- spec/lib/gitlab/auth/ldap/user_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/lib/gitlab/auth/ldap/user_spec.rb b/spec/lib/gitlab/auth/ldap/user_spec.rb index 0e3a6bac02a2ea..1f0b3d4d4b474a 100644 --- a/spec/lib/gitlab/auth/ldap/user_spec.rb +++ b/spec/lib/gitlab/auth/ldap/user_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Gitlab::Auth::Ldap::User do include LdapHelpers - let(:organization) { create(:organization) } + let_it_be(:organization) { create(:organization) } let(:ldap_user) { described_class.new(auth_hash, organization_id: organization.id) } let(:gl_user) { ldap_user.gl_user } let(:info) do -- GitLab From 823e2eeba34017c7b565f53432ba82d7355a1962 Mon Sep 17 00:00:00 2001 From: Abdul Wadood Date: Fri, 23 Aug 2024 18:33:45 +0530 Subject: [PATCH 4/4] Fix spec failures Use with_current_organization to mock the current organization or with_default_organization to create the default organization to fix the specs. --- ee/spec/features/registrations/identity_verification_spec.rb | 2 +- .../saas/standard_flow_company_joining_project_spec.rb | 2 +- .../saas/standard_flow_just_me_importing_project_spec.rb | 2 +- .../saas/standard_flow_just_me_joining_project_spec.rb | 2 +- .../saas/subscription_flow_company_paid_plan_spec.rb | 2 +- .../saas/subscription_flow_just_me_paid_plan_spec.rb | 2 +- .../saas/trial_flow_company_importing_project_spec.rb | 2 +- .../saas/trial_flow_just_me_importing_project_spec.rb | 2 +- lib/gitlab/auth/o_auth/user.rb | 5 +---- spec/features/registrations/oauth_registration_spec.rb | 2 +- 10 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ee/spec/features/registrations/identity_verification_spec.rb b/ee/spec/features/registrations/identity_verification_spec.rb index aa0febd4964e5f..f89209d27fa372 100644 --- a/ee/spec/features/registrations/identity_verification_spec.rb +++ b/ee/spec/features/registrations/identity_verification_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Identity Verification', :js, feature_category: :instance_resiliency do +RSpec.describe 'Identity Verification', :js, :with_current_organization, feature_category: :instance_resiliency do include IdentityVerificationHelpers before do diff --git a/ee/spec/features/registrations/saas/standard_flow_company_joining_project_spec.rb b/ee/spec/features/registrations/saas/standard_flow_company_joining_project_spec.rb index aa8b6c975224fd..2b55eca648bb76 100644 --- a/ee/spec/features/registrations/saas/standard_flow_company_joining_project_spec.rb +++ b/ee/spec/features/registrations/saas/standard_flow_company_joining_project_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Standard flow for user picking company and joining a project', :js, :saas_registration, feature_category: :onboarding do +RSpec.describe 'Standard flow for user picking company and joining a project', :js, :saas_registration, :with_current_organization, feature_category: :onboarding do where(:case_name, :sign_up_method) do [ ['with regular sign up', -> { regular_sign_up }], diff --git a/ee/spec/features/registrations/saas/standard_flow_just_me_importing_project_spec.rb b/ee/spec/features/registrations/saas/standard_flow_just_me_importing_project_spec.rb index 13fda8ba48d870..fe8727633f56f2 100644 --- a/ee/spec/features/registrations/saas/standard_flow_just_me_importing_project_spec.rb +++ b/ee/spec/features/registrations/saas/standard_flow_just_me_importing_project_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Standard flow for user picking just me and importing a project', :js, :saas_registration, feature_category: :onboarding do +RSpec.describe 'Standard flow for user picking just me and importing a project', :js, :saas_registration, :with_default_organization, feature_category: :onboarding do where(:case_name, :sign_up_method) do [ ['with regular sign up', -> { regular_sign_up }], diff --git a/ee/spec/features/registrations/saas/standard_flow_just_me_joining_project_spec.rb b/ee/spec/features/registrations/saas/standard_flow_just_me_joining_project_spec.rb index 295180ccbae2ad..91a27bd4efd93d 100644 --- a/ee/spec/features/registrations/saas/standard_flow_just_me_joining_project_spec.rb +++ b/ee/spec/features/registrations/saas/standard_flow_just_me_joining_project_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Standard flow for user picking just me and joining a project', :js, :saas_registration, feature_category: :onboarding do +RSpec.describe 'Standard flow for user picking just me and joining a project', :js, :saas_registration, :with_current_organization, feature_category: :onboarding do where(:case_name, :sign_up_method) do [ ['with regular sign up', -> { regular_sign_up }], diff --git a/ee/spec/features/registrations/saas/subscription_flow_company_paid_plan_spec.rb b/ee/spec/features/registrations/saas/subscription_flow_company_paid_plan_spec.rb index 52588368a9f165..99b82ca3397073 100644 --- a/ee/spec/features/registrations/saas/subscription_flow_company_paid_plan_spec.rb +++ b/ee/spec/features/registrations/saas/subscription_flow_company_paid_plan_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Subscription flow for user picking company for paid plan', :js, :saas_registration, feature_category: :onboarding do +RSpec.describe 'Subscription flow for user picking company for paid plan', :js, :saas_registration, :with_default_organization, feature_category: :onboarding do where(:case_name, :sign_up_method) do [ ['with regular sign up', -> { subscription_regular_sign_up }], diff --git a/ee/spec/features/registrations/saas/subscription_flow_just_me_paid_plan_spec.rb b/ee/spec/features/registrations/saas/subscription_flow_just_me_paid_plan_spec.rb index 6511f9726b7984..b6f7d7b08718a3 100644 --- a/ee/spec/features/registrations/saas/subscription_flow_just_me_paid_plan_spec.rb +++ b/ee/spec/features/registrations/saas/subscription_flow_just_me_paid_plan_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Subscription flow for user picking just me for paid plan', :js, :saas_registration, feature_category: :onboarding do +RSpec.describe 'Subscription flow for user picking just me for paid plan', :js, :saas_registration, :with_default_organization, feature_category: :onboarding do where(:case_name, :sign_up_method) do [ ['with regular sign up', -> { subscription_regular_sign_up }], diff --git a/ee/spec/features/registrations/saas/trial_flow_company_importing_project_spec.rb b/ee/spec/features/registrations/saas/trial_flow_company_importing_project_spec.rb index 8d898d1fade5ae..9ab005786d28cf 100644 --- a/ee/spec/features/registrations/saas/trial_flow_company_importing_project_spec.rb +++ b/ee/spec/features/registrations/saas/trial_flow_company_importing_project_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Trial flow for user picking company and importing a project', :js, :saas_registration, feature_category: :onboarding do +RSpec.describe 'Trial flow for user picking company and importing a project', :js, :saas_registration, :with_default_organization, feature_category: :onboarding do where(:case_name, :sign_up_method) do [ ['with regular trial sign up', -> { trial_registration_sign_up }], diff --git a/ee/spec/features/registrations/saas/trial_flow_just_me_importing_project_spec.rb b/ee/spec/features/registrations/saas/trial_flow_just_me_importing_project_spec.rb index 1108292e1548ae..e8a7f118144d88 100644 --- a/ee/spec/features/registrations/saas/trial_flow_just_me_importing_project_spec.rb +++ b/ee/spec/features/registrations/saas/trial_flow_just_me_importing_project_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Trial flow for user picking just me and importing a project', :js, :saas_registration, feature_category: :onboarding do +RSpec.describe 'Trial flow for user picking just me and importing a project', :js, :saas_registration, :with_default_organization, feature_category: :onboarding do where(:case_name, :sign_up_method) do [ ['with regular trial sign up', -> { trial_registration_sign_up }], diff --git a/lib/gitlab/auth/o_auth/user.rb b/lib/gitlab/auth/o_auth/user.rb index e29981455a3bdb..3a85ffe22c0e3c 100644 --- a/lib/gitlab/auth/o_auth/user.rb +++ b/lib/gitlab/auth/o_auth/user.rb @@ -222,10 +222,7 @@ def find_by_uid_and_provider end def build_new_user(skip_confirmation: true) - user_params = user_attributes - .merge(skip_confirmation: skip_confirmation) - .merge(@user_params) - + user_params = user_attributes.merge(skip_confirmation: skip_confirmation) Users::AuthorizedBuildService.new(nil, user_params).execute end diff --git a/spec/features/registrations/oauth_registration_spec.rb b/spec/features/registrations/oauth_registration_spec.rb index e9baf7bc393917..50afb3076279c8 100644 --- a/spec/features/registrations/oauth_registration_spec.rb +++ b/spec/features/registrations/oauth_registration_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'OAuth Registration', :js, :allow_forgery_protection, feature_category: :system_access do +RSpec.describe 'OAuth Registration', :js, :allow_forgery_protection, :with_current_organization, feature_category: :system_access do include LoginHelpers include TermsHelper using RSpec::Parameterized::TableSyntax -- GitLab