Commit e1f09138 authored by Małgorzata Ksionek's avatar Małgorzata Ksionek

Add cr remarks

Add cr remarks

Add cr remarks

Add workers data

Add cr remarks
parent 380a73cc
...@@ -99,11 +99,12 @@ module Groups ...@@ -99,11 +99,12 @@ module Groups
def update_two_factor_requirement_for_subgroups def update_two_factor_requirement_for_subgroups
settings = group.namespace_settings settings = group.namespace_settings
return if settings.allow_mfa_for_subgroups
return if settings.allow_mfa_for_subgroups
binding.pry
if settings.previous_changes.include?(:allow_mfa_for_subgroups) if settings.previous_changes.include?(:allow_mfa_for_subgroups)
# enque in batches members update # enque in batches members update
DisallowTwoFaWorker.perform_async(group.id) DisallowTwoFactorForSubgroupsWorker.perform_async(group.id)
end end
end end
...@@ -129,7 +130,7 @@ module Groups ...@@ -129,7 +130,7 @@ module Groups
end end
def allowed_settings_params def allowed_settings_params
@allowed_settings_params ||= SETTINGS_PARAMS SETTINGS_PARAMS
end end
def valid_share_with_group_lock_change? def valid_share_with_group_lock_change?
......
...@@ -1393,21 +1393,21 @@ ...@@ -1393,21 +1393,21 @@
:weight: 1 :weight: 1
:idempotent: :idempotent:
:tags: [] :tags: []
- :name: disallow_two_fa - :name: disallow_two_factor_for_group
:feature_category: :subgroups :feature_category: :subgroups
:has_external_dependencies: :has_external_dependencies:
:urgency: :low :urgency: :low
:resource_boundary: :unknown :resource_boundary: :unknown
:weight: 1 :weight: 1
:idempotent: :idempotent: true
:tags: [] :tags: []
- :name: disallow_two_fa_for_subgroups - :name: disallow_two_factor_for_subgroups
:feature_category: :subgroups :feature_category: :subgroups
:has_external_dependencies: :has_external_dependencies:
:urgency: :low :urgency: :low
:resource_boundary: :unknown :resource_boundary: :unknown
:weight: 1 :weight: 1
:idempotent: :idempotent: true
:tags: [] :tags: []
- :name: email_receiver - :name: email_receiver
:feature_category: :issue_tracking :feature_category: :issue_tracking
......
# frozen_string_literal: true # frozen_string_literal: true
class DisallowTwoFaForSubgroupsWorker # rubocop:disable Scalability/IdempotentWorker class DisallowTwoFactorForGroupWorker
include ApplicationWorker include ApplicationWorker
include ExceptionBacktrace include ExceptionBacktrace
feature_category :subgroups feature_category :subgroups
idempotent!
def perform(group_id) def perform(group_id)
begin begin
......
# frozen_string_literal: true # frozen_string_literal: true
class DisallowTwoFaWorker # rubocop:disable Scalability/IdempotentWorker class DisallowTwoFactorForSubgroupsWorker
include ApplicationWorker include ApplicationWorker
include ExceptionBacktrace include ExceptionBacktrace
INTERVAL = 2.seconds.to_i INTERVAL = 2.seconds.to_i
feature_category :subgroups feature_category :subgroups
idempotent!
def perform(group_id) def perform(group_id)
begin begin
...@@ -21,7 +22,7 @@ class DisallowTwoFaWorker # rubocop:disable Scalability/IdempotentWorker ...@@ -21,7 +22,7 @@ class DisallowTwoFaWorker # rubocop:disable Scalability/IdempotentWorker
delay = index * INTERVAL delay = index * INTERVAL
with_context(namespace: subgroup) do with_context(namespace: subgroup) do
DisallowTwoFaForSubgroupsWorker.perform_in(delay, subgroup.id) DisallowTwoFactorForGroupWorker.perform_in(delay, subgroup.id)
end end
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
...@@ -84,9 +84,9 @@ ...@@ -84,9 +84,9 @@
- 1 - 1
- - detect_repository_languages - - detect_repository_languages
- 1 - 1
- - disallow_two_fa - - disallow_two_factor_for_group
- 1 - 1
- - disallow_two_fa_for_subgroups - - disallow_two_factor_for_subgroups
- 1 - 1
- - elastic_commit_indexer - - elastic_commit_indexer
- 1 - 1
......
...@@ -116,7 +116,7 @@ module EE ...@@ -116,7 +116,7 @@ module EE
override :allowed_settings_params override :allowed_settings_params
def allowed_settings_params def allowed_settings_params
@allowed_settings_params ||= ::Groups::UpdateService::SETTINGS_PARAMS + EE_SETTINGS_PARAMS @allowed_settings_params ||= super + EE_SETTINGS_PARAMS
end end
def log_audit_event def log_audit_event
......
...@@ -321,7 +321,7 @@ RSpec.describe Groups::UpdateService do ...@@ -321,7 +321,7 @@ RSpec.describe Groups::UpdateService do
end end
it 'enqueues update subgroups and its members' do it 'enqueues update subgroups and its members' do
expect(DisallowTwoFaWorker).to receive(:perform_async).with(group.id) expect(DisallowTwoFactorForSubgroupsWorker).to receive(:perform_async).with(group.id)
subject subject
end end
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe DisallowTwoFaForSubgroupsWorker do RSpec.describe DisallowTwoFactorForGroupWorker do
let_it_be(:group) { create(:group, require_two_factor_authentication: true) } let_it_be(:group) { create(:group, require_two_factor_authentication: true) }
let_it_be(:user) { create(:user, require_two_factor_authentication_from_group: true) } let_it_be(:user) { create(:user, require_two_factor_authentication_from_group: true) }
......
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe DisallowTwoFaWorker do RSpec.describe DisallowTwoFactorForSubgroupsWorker do
let_it_be(:group) { create(:group) } let_it_be(:group) { create(:group) }
let_it_be(:subgroup_with_2fa) { create(:group, parent: group, require_two_factor_authentication: true) } let_it_be(:subgroup_with_2fa) { create(:group, parent: group, require_two_factor_authentication: true) }
let_it_be(:subgroup_without_2fa) { create(:group, parent: group, require_two_factor_authentication: false) } let_it_be(:subgroup_without_2fa) { create(:group, parent: group, require_two_factor_authentication: false) }
let_it_be(:subsubgroup_with_2fa) { create(:group, parent: subgroup_with_2fa, require_two_factor_authentication: true) } let_it_be(:subsubgroup_with_2fa) { create(:group, parent: subgroup_with_2fa, require_two_factor_authentication: true) }
it "schedules updating subgroups" do it "schedules updating subgroups" do
expect(DisallowTwoFaForSubgroupsWorker).to receive(:perform_in).with(0, subgroup_with_2fa.id) expect(DisallowTwoFactorForGroupWorker).to receive(:perform_in).with(0, subgroup_with_2fa.id)
expect(DisallowTwoFaForSubgroupsWorker).to receive(:perform_in).with(2, subsubgroup_with_2fa.id) expect(DisallowTwoFactorForGroupWorker).to receive(:perform_in).with(2, subsubgroup_with_2fa.id)
described_class.new.perform(group.id) described_class.new.perform(group.id)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment