From ee87ce1613c065b7be537296026039dcb309fc03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 10 Oct 2022 20:36:20 +0200 Subject: [PATCH] Remove EE checks from 2FA --- .../two-factor-authentication/README.md | 2 - .../two_factor_settings_controller.rb | 7 - .../token_strategy_manager.rb | 2 +- .../authentication_controller_spec.rb | 4 +- .../two_factor_devices_controller_spec.rb | 2 +- .../my/two_factor_devices_controller_spec.rb | 2 +- .../two_factor_devices_controller_spec.rb | 2 +- .../spec/features/account_activation_spec.rb | 1 - .../admin_edit_two_factor_devices_spec.rb | 1 - .../generate_backup_codes_spec.rb | 2 +- .../login_with_backup_code_spec.rb | 2 +- .../features/login/login_enforced_2fa_spec.rb | 1 - .../features/login/login_with_2fa_spec.rb | 1 - .../features/login/login_without_2fa_spec.rb | 2 +- .../login/switch_available_devices_spec.rb | 1 - .../features/my_two_factor_devices_spec.rb | 1 - .../spec/features/password_change_spec.rb | 1 - .../login_with_remember_cookie_spec.rb | 1 - .../lib/token_strategies/message_bird_spec.rb | 2 +- .../spec/lib/token_strategy_manager_spec.rb | 158 ++++++++---------- .../models/devices/default_device_spec.rb | 2 +- .../spec/models/devices/totp_spec.rb | 2 +- .../spec/models/login_token_spec.rb | 2 +- .../spec/models/user_spec.rb | 2 +- .../token_delivery/message_bird_spec.rb | 2 +- .../spec/services/token_delivery/sns_spec.rb | 2 +- .../spec/services/token_delivery/totp_spec.rb | 2 +- .../spec/services/token_service_spec.rb | 2 +- .../spec/spec_helper.rb | 15 -- 29 files changed, 87 insertions(+), 139 deletions(-) diff --git a/docs/system-admin-guide/authentication/two-factor-authentication/README.md b/docs/system-admin-guide/authentication/two-factor-authentication/README.md index e623fa64fc..cb99b4e2f4 100644 --- a/docs/system-admin-guide/authentication/two-factor-authentication/README.md +++ b/docs/system-admin-guide/authentication/two-factor-authentication/README.md @@ -7,8 +7,6 @@ keywords: two-factor authentication --- # Two-factor authentication (2FA) -Note: This feature is available for the Enterprise on-premises only. For more information and differences to Community Edition, [see this page](https://www.openproject.org/pricing/). - ## Basic 2FA using TOTP To activate and **configure two-factor authentication** for OpenProject, navigate to -> *Administration* -> *Authentication* and choose -> *two-factor authentication*. diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/two_factor_settings_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/two_factor_settings_controller.rb index 701b950449..c1e74978c7 100644 --- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/two_factor_settings_controller.rb +++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/two_factor_settings_controller.rb @@ -3,7 +3,6 @@ module ::TwoFactorAuthentication include EnterpriseTrialHelper before_action :require_admin before_action :check_enabled - before_action :check_ee layout 'admin' menu_item :two_factor_authentication @@ -49,12 +48,6 @@ module ::TwoFactorAuthentication render_403 unless manager.configurable_by_ui? end - def check_ee - unless EnterpriseToken.allows_to?(:two_factor_authentication) - render template: 'two_factor_authentication/upsale' - end - end - def manager ::OpenProject::TwoFactorAuthentication::TokenStrategyManager end diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy_manager.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy_manager.rb index 1a00c11452..c1c20e274e 100644 --- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy_manager.rb +++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy_manager.rb @@ -39,7 +39,7 @@ module OpenProject::TwoFactorAuthentication ## # Whether any active strategy exists def enabled? - !active_strategies.empty? && EnterpriseToken.allows_to?(:two_factor_authentication) + !active_strategies.empty? end ## diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb index 131e4cbce7..7aff270190 100644 --- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb +++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb @@ -1,7 +1,7 @@ require_relative '../../spec_helper' require_relative './authentication_controller_shared_examples' -describe ::TwoFactorAuthentication::AuthenticationController, with_2fa_ee: true, with_settings: { login_required?: true } do +describe ::TwoFactorAuthentication::AuthenticationController, with_settings: { login_required?: true } do let(:valid_credentials) do { username: 'foobar', password: 'AAA1111!!!!' } end @@ -27,7 +27,7 @@ describe ::TwoFactorAuthentication::AuthenticationController, with_2fa_ee: true, before do allow(OpenProject::TwoFactorAuthentication::TokenStrategyManager) .to receive(:add_default_strategy?) - .and_return false + .and_return false session[:authenticated_user_id] = user.id get :request_otp end diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb index 189aa535a3..15119e0562 100644 --- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb +++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb @@ -1,7 +1,7 @@ require_relative '../../../spec_helper' require_relative './../authentication_controller_shared_examples' -describe ::TwoFactorAuthentication::ForcedRegistration::TwoFactorDevicesController, with_2fa_ee: true do +describe ::TwoFactorAuthentication::ForcedRegistration::TwoFactorDevicesController do let(:user) { create(:user, login: 'foobar') } let(:logged_in_user) { User.anonymous } let(:active_strategies) { [] } diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb index 0ce5763a16..3f4e1f8e9c 100644 --- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb +++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb @@ -1,7 +1,7 @@ require_relative '../../../spec_helper' require_relative './../authentication_controller_shared_examples' -describe ::TwoFactorAuthentication::My::TwoFactorDevicesController, with_2fa_ee: true do +describe ::TwoFactorAuthentication::My::TwoFactorDevicesController do let(:user) { create(:user, login: 'foobar') } let(:other_user) { create(:user) } let(:logged_in_user) { user } diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb index 8deed15775..0f9c430f89 100644 --- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb +++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb @@ -1,7 +1,7 @@ require_relative '../../../spec_helper' require_relative './../authentication_controller_shared_examples' -describe ::TwoFactorAuthentication::Users::TwoFactorDevicesController, with_2fa_ee: true do +describe ::TwoFactorAuthentication::Users::TwoFactorDevicesController do let(:admin) { create :admin } let(:user) { create(:user, login: 'foobar') } let(:other_user) { create(:user) } diff --git a/modules/two_factor_authentication/spec/features/account_activation_spec.rb b/modules/two_factor_authentication/spec/features/account_activation_spec.rb index bdb0b2f81c..4e0cd4fbe2 100644 --- a/modules/two_factor_authentication/spec/features/account_activation_spec.rb +++ b/modules/two_factor_authentication/spec/features/account_activation_spec.rb @@ -2,7 +2,6 @@ require_relative '../spec_helper' require_relative './shared_2fa_examples' describe 'activating an invited account', - with_2fa_ee: true, type: :feature, js: true, with_settings: { diff --git a/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb index bcdc9be543..b482f55f5b 100644 --- a/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb +++ b/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb @@ -1,7 +1,6 @@ require_relative '../spec_helper' describe 'Admin 2FA management', - with_2fa_ee: true, type: :feature, with_settings: { plugin_openproject_two_factor_authentication: { 'active_strategies' => %i[developer totp] } diff --git a/modules/two_factor_authentication/spec/features/backup_codes/generate_backup_codes_spec.rb b/modules/two_factor_authentication/spec/features/backup_codes/generate_backup_codes_spec.rb index 8e308979e9..9ec1fac372 100644 --- a/modules/two_factor_authentication/spec/features/backup_codes/generate_backup_codes_spec.rb +++ b/modules/two_factor_authentication/spec/features/backup_codes/generate_backup_codes_spec.rb @@ -1,7 +1,7 @@ require_relative '../../spec_helper' require_relative '../shared_2fa_examples' -describe 'Generate 2FA backup codes', with_2fa_ee: true, type: :feature, +describe 'Generate 2FA backup codes', type: :feature, with_config: { '2fa': { active_strategies: [:developer] } }, js: true do let(:user_password) { 'bob!' * 4 } diff --git a/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb b/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb index dd1c20852b..4c39298256 100644 --- a/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb +++ b/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb @@ -1,7 +1,7 @@ require_relative '../../spec_helper' require_relative '../shared_2fa_examples' -describe 'Login with 2FA backup code', with_2fa_ee: true, type: :feature, +describe 'Login with 2FA backup code', type: :feature, with_settings: { plugin_openproject_two_factor_authentication: { 'active_strategies' => [:developer] } }, diff --git a/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb index 87e229cb22..ac3084455e 100644 --- a/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb +++ b/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb @@ -2,7 +2,6 @@ require_relative '../../spec_helper' require_relative '../shared_2fa_examples' describe 'Login with enforced 2FA', - with_2fa_ee: true, type: :feature, with_settings: { plugin_openproject_two_factor_authentication: { diff --git a/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb index df5c43b0fd..9196d89cdc 100644 --- a/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb +++ b/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb @@ -2,7 +2,6 @@ require_relative '../../spec_helper' require_relative '../shared_2fa_examples' describe 'Login with 2FA device', - with_2fa_ee: true, type: :feature, with_settings: { plugin_openproject_two_factor_authentication: { diff --git a/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb index 1f78a114b8..e08e54beb0 100644 --- a/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb +++ b/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb @@ -1,7 +1,7 @@ require_relative '../../spec_helper' require_relative '../shared_2fa_examples' -describe 'Login with no required OTP', with_2fa_ee: true, type: :feature, +describe 'Login with no required OTP', type: :feature, with_config: { '2fa': { active_strategies: [:developer] } }, js: true do let(:user_password) { 'bob!' * 4 } diff --git a/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb b/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb index 886512652b..18d7bd13be 100644 --- a/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb +++ b/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb @@ -2,7 +2,6 @@ require_relative '../../spec_helper' require_relative '../shared_2fa_examples' describe 'Login by switching 2FA device', - with_2fa_ee: true, type: :feature, with_settings: { plugin_openproject_two_factor_authentication: { 'active_strategies' => %i[developer totp] } diff --git a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb index 56ac07f9bd..1aae048d61 100644 --- a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb +++ b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb @@ -1,7 +1,6 @@ require_relative '../spec_helper' describe 'My Account 2FA configuration', - with_2fa_ee: true, type: :feature, with_settings: { plugin_openproject_two_factor_authentication: { 'active_strategies' => %i[developer totp] } diff --git a/modules/two_factor_authentication/spec/features/password_change_spec.rb b/modules/two_factor_authentication/spec/features/password_change_spec.rb index e04a5d0c1e..b4fd95270d 100644 --- a/modules/two_factor_authentication/spec/features/password_change_spec.rb +++ b/modules/two_factor_authentication/spec/features/password_change_spec.rb @@ -1,7 +1,6 @@ require_relative '../spec_helper' describe 'Password change with OTP', - with_2fa_ee: true, type: :feature, with_settings: { plugin_openproject_two_factor_authentication: { diff --git a/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb b/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb index 16cb13d0ad..30f7c8a2bb 100644 --- a/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb +++ b/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb @@ -3,7 +3,6 @@ require_relative '../shared_2fa_examples' describe 'Login with 2FA remember cookie', type: :feature, - with_2fa_ee: true, with_settings: { plugin_openproject_two_factor_authentication: { active_strategies: [:developer], diff --git a/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb b/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb index 867a3534a6..beb9ecc3d4 100644 --- a/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb +++ b/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb @@ -1,7 +1,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'messagebird' -describe ::OpenProject::TwoFactorAuthentication::TokenStrategy::MessageBird, with_2fa_ee: true do +describe ::OpenProject::TwoFactorAuthentication::TokenStrategy::MessageBird do let(:channel) { :sms } let(:locale) { 'en' } let(:user) { create :user, language: locale } diff --git a/modules/two_factor_authentication/spec/lib/token_strategy_manager_spec.rb b/modules/two_factor_authentication/spec/lib/token_strategy_manager_spec.rb index 5d8c655ffd..4f33c0005b 100644 --- a/modules/two_factor_authentication/spec/lib/token_strategy_manager_spec.rb +++ b/modules/two_factor_authentication/spec/lib/token_strategy_manager_spec.rb @@ -1,6 +1,5 @@ require_relative '../spec_helper' -# rubocop:disable RSpec/NestedGroups describe ::OpenProject::TwoFactorAuthentication::TokenStrategyManager do let(:dev_strategy) { ::OpenProject::TwoFactorAuthentication::TokenStrategy::Developer } let(:totp_strategy) { ::OpenProject::TwoFactorAuthentication::TokenStrategy::Totp } @@ -12,129 +11,110 @@ describe ::OpenProject::TwoFactorAuthentication::TokenStrategyManager do end let(:enforced) { false } - context 'without EE' do - include_context 'with settings' do - let(:settings) do - { - plugin_openproject_two_factor_authentication: { - 'active_strategies' => %i[developer] - } - } - end - end - - it 'is not enabled' do - expect(described_class).not_to be_enabled + include_context 'with settings' do + let(:settings) do + { + plugin_openproject_two_factor_authentication: configuration + } end end - context 'with EE', with_2fa_ee: true do - include_context 'with settings' do - let(:settings) do - { - plugin_openproject_two_factor_authentication: configuration - } - end - end - - describe '#find_matching_strategy' do - subject { described_class.find_matching_strategy(:sms) } + describe '#find_matching_strategy' do + subject { described_class.find_matching_strategy(:sms) } - context 'when no strategy is set' do - let(:active_strategies) { [] } + context 'when no strategy is set' do + let(:active_strategies) { [] } - it 'returns nil' do - expect(subject).to be_nil - end + it 'returns nil' do + expect(subject).to be_nil end + end - context 'when matching strategy exists' do - let(:active_strategies) { [:developer] } + context 'when matching strategy exists' do + let(:active_strategies) { [:developer] } - it 'returns the strategy' do - expect(subject).to eq(dev_strategy) - end + it 'returns the strategy' do + expect(subject).to eq(dev_strategy) end + end - context 'when non-matching strategy exists' do - let(:active_strategies) { [:totp] } + context 'when non-matching strategy exists' do + let(:active_strategies) { [:totp] } - it 'returns the strategy' do - expect(subject).to be_nil - end + it 'returns the strategy' do + expect(subject).to be_nil end end + end - describe '#active_strategies' do - context 'with bogus strategy' do - let(:active_strategies) { [:doesnotexist] } + describe '#active_strategies' do + context 'with bogus strategy' do + let(:active_strategies) { [:doesnotexist] } - it 'raises when accessing' do - expect { described_class.active_strategies }.to raise_error(ArgumentError) - end + it 'raises when accessing' do + expect { described_class.active_strategies }.to raise_error(ArgumentError) + end - it 'raises when validating' do - expect { described_class.validate_active_strategies! }.to raise_error(ArgumentError) - end + it 'raises when validating' do + expect { described_class.validate_active_strategies! }.to raise_error(ArgumentError) end end + end - describe '#validate_active_strategies!' do - subject { described_class.validate_active_strategies! } + describe '#validate_active_strategies!' do + subject { described_class.validate_active_strategies! } - context 'when no strategy is set' do - let(:active_strategies) { [] } + context 'when no strategy is set' do + let(:active_strategies) { [] } - before do - allow(OpenProject::TwoFactorAuthentication::TokenStrategyManager) - .to receive(:add_default_strategy?) - .and_return false - end + before do + allow(OpenProject::TwoFactorAuthentication::TokenStrategyManager) + .to receive(:add_default_strategy?) + .and_return false + end - context 'when enforced is false' do - let(:enforced) { false } + context 'when enforced is false' do + let(:enforced) { false } - it 'accepts that' do - expect { subject }.not_to raise_error - expect(described_class).not_to be_enabled - expect(described_class).not_to be_enforced - end + it 'accepts that' do + expect { subject }.not_to raise_error + expect(described_class).not_to be_enabled + expect(described_class).not_to be_enforced end + end - context 'when enforced is true' do - let(:enforced) { true } + context 'when enforced is true' do + let(:enforced) { true } - it 'raises and error that a strategy is needed' do - expect { subject }.to raise_error(ArgumentError) - expect(described_class).not_to be_enabled - expect(described_class).to be_enforced - end + it 'raises and error that a strategy is needed' do + expect { subject }.to raise_error(ArgumentError) + expect(described_class).not_to be_enabled + expect(described_class).to be_enforced end end + end - context 'when a strategy is set' do - let(:active_strategies) { [:developer] } + context 'when a strategy is set' do + let(:active_strategies) { [:developer] } - context 'when it is valid' do - it 'returns that' do - expect { subject }.not_to raise_error - expect(described_class.active_strategies).to eq([dev_strategy]) - expect(described_class).to be_enabled - expect(described_class).not_to be_enforced - end + context 'when it is valid' do + it 'returns that' do + expect { subject }.not_to raise_error + expect(described_class.active_strategies).to eq([dev_strategy]) + expect(described_class).to be_enabled + expect(described_class).not_to be_enforced end + end - context 'when it is invalid' do - it 'raises' do - allow(dev_strategy).to receive(:validate!).and_raise 'Error!' + context 'when it is invalid' do + it 'raises' do + allow(dev_strategy).to receive(:validate!).and_raise 'Error!' - expect { subject }.to raise_error 'Error!' - expect(described_class).to be_enabled - expect(described_class).not_to be_enforced - end + expect { subject }.to raise_error 'Error!' + expect(described_class).to be_enabled + expect(described_class).not_to be_enforced end end end end end -# rubocop:enable RSpec/NestedGroups diff --git a/modules/two_factor_authentication/spec/models/devices/default_device_spec.rb b/modules/two_factor_authentication/spec/models/devices/default_device_spec.rb index b3c4ad8151..6ea6b4bc87 100644 --- a/modules/two_factor_authentication/spec/models/devices/default_device_spec.rb +++ b/modules/two_factor_authentication/spec/models/devices/default_device_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Default device', with_2fa_ee: true, type: :model do +describe 'Default device', type: :model do let(:user) { create :user } let(:subject) { build :two_factor_authentication_device_totp, user:, default: true } let(:other_otp) { build :two_factor_authentication_device_totp, user:, default: true } diff --git a/modules/two_factor_authentication/spec/models/devices/totp_spec.rb b/modules/two_factor_authentication/spec/models/devices/totp_spec.rb index 2665a91fe0..d5ad2a279a 100644 --- a/modules/two_factor_authentication/spec/models/devices/totp_spec.rb +++ b/modules/two_factor_authentication/spec/models/devices/totp_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'timecop' -describe ::TwoFactorAuthentication::Device::Totp, with_2fa_ee: true, type: :model do +describe ::TwoFactorAuthentication::Device::Totp, type: :model do let(:user) { create :user } let(:channel) { :totp } diff --git a/modules/two_factor_authentication/spec/models/login_token_spec.rb b/modules/two_factor_authentication/spec/models/login_token_spec.rb index 9465c2e30a..ff0565999f 100644 --- a/modules/two_factor_authentication/spec/models/login_token_spec.rb +++ b/modules/two_factor_authentication/spec/models/login_token_spec.rb @@ -1,6 +1,6 @@ require_relative '../spec_helper' -describe TwoFactorAuthentication::LoginToken, with_2fa_ee: true do +describe TwoFactorAuthentication::LoginToken do before do @user = build_stubbed(:user, login: "john", password: "doe") allow(@user).to receive(:new_record?).and_return(false) diff --git a/modules/two_factor_authentication/spec/models/user_spec.rb b/modules/two_factor_authentication/spec/models/user_spec.rb index e949a77aa7..70d7ff0dbd 100644 --- a/modules/two_factor_authentication/spec/models/user_spec.rb +++ b/modules/two_factor_authentication/spec/models/user_spec.rb @@ -2,7 +2,7 @@ require_relative '../spec_helper' module OpenProject::TwoFactorAuthentication::Patches module UserSpec - describe User, with_2fa_ee: true do + describe User do def create_user(auth_source_id = nil) @user = build(:user) @username = @user.login diff --git a/modules/two_factor_authentication/spec/services/token_delivery/message_bird_spec.rb b/modules/two_factor_authentication/spec/services/token_delivery/message_bird_spec.rb index ef39bec22e..e2b5b07e11 100644 --- a/modules/two_factor_authentication/spec/services/token_delivery/message_bird_spec.rb +++ b/modules/two_factor_authentication/spec/services/token_delivery/message_bird_spec.rb @@ -1,7 +1,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'messagebird' -describe ::OpenProject::TwoFactorAuthentication::TokenStrategy::MessageBird, with_2fa_ee: true do +describe ::OpenProject::TwoFactorAuthentication::TokenStrategy::MessageBird do describe 'sending messages' do let!(:user) { create :user, language: locale } let!(:locale) { 'en' } diff --git a/modules/two_factor_authentication/spec/services/token_delivery/sns_spec.rb b/modules/two_factor_authentication/spec/services/token_delivery/sns_spec.rb index bab02046b5..e982700e47 100644 --- a/modules/two_factor_authentication/spec/services/token_delivery/sns_spec.rb +++ b/modules/two_factor_authentication/spec/services/token_delivery/sns_spec.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') -describe ::OpenProject::TwoFactorAuthentication::TokenStrategy::Sns, with_2fa_ee: true do +describe ::OpenProject::TwoFactorAuthentication::TokenStrategy::Sns do describe 'sending messages' do let(:phone) { '+49 123456789' } let!(:user) { create :user } diff --git a/modules/two_factor_authentication/spec/services/token_delivery/totp_spec.rb b/modules/two_factor_authentication/spec/services/token_delivery/totp_spec.rb index 31d9aed32a..ddb0ce734b 100644 --- a/modules/two_factor_authentication/spec/services/token_delivery/totp_spec.rb +++ b/modules/two_factor_authentication/spec/services/token_delivery/totp_spec.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') -describe ::OpenProject::TwoFactorAuthentication::TokenStrategy::Totp, with_2fa_ee: true do +describe ::OpenProject::TwoFactorAuthentication::TokenStrategy::Totp do describe 'sending messages' do let!(:user) { create :user } let!(:device) { create :two_factor_authentication_device_totp, user:, default: true } diff --git a/modules/two_factor_authentication/spec/services/token_service_spec.rb b/modules/two_factor_authentication/spec/services/token_service_spec.rb index 5e8c95a874..88a75e2fa3 100644 --- a/modules/two_factor_authentication/spec/services/token_service_spec.rb +++ b/modules/two_factor_authentication/spec/services/token_service_spec.rb @@ -1,6 +1,6 @@ require_relative '../spec_helper' -describe ::TwoFactorAuthentication::TokenService, with_2fa_ee: true do +describe ::TwoFactorAuthentication::TokenService do describe 'sending messages' do let(:user) { create(:user) } let(:dev_strategy) { ::OpenProject::TwoFactorAuthentication::TokenStrategy::Developer } diff --git a/modules/two_factor_authentication/spec/spec_helper.rb b/modules/two_factor_authentication/spec/spec_helper.rb index a4925939ec..4351818bd6 100644 --- a/modules/two_factor_authentication/spec/spec_helper.rb +++ b/modules/two_factor_authentication/spec/spec_helper.rb @@ -1,17 +1,2 @@ # -- load spec_helper from OpenProject core require "spec_helper" - -RSpec.configure do |config| - config.before do |example| - next unless example.metadata[:with_2fa_ee] - - allow(EnterpriseToken) - .to receive(:allows_to?) - .and_call_original - - allow(EnterpriseToken) - .to receive(:allows_to?) - .with(:two_factor_authentication) - .and_return true - end -end