Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e1f09138
Commit
e1f09138
authored
Oct 12, 2020
by
Małgorzata Ksionek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cr remarks
Add cr remarks Add cr remarks Add workers data Add cr remarks
parent
380a73cc
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
21 additions
and
18 deletions
+21
-18
app/services/groups/update_service.rb
app/services/groups/update_service.rb
+4
-3
app/workers/all_queues.yml
app/workers/all_queues.yml
+4
-4
app/workers/disallow_two_factor_for_group_worker.rb
app/workers/disallow_two_factor_for_group_worker.rb
+2
-1
app/workers/disallow_two_factor_for_subgroups_worker.rb
app/workers/disallow_two_factor_for_subgroups_worker.rb
+3
-2
config/sidekiq_queues.yml
config/sidekiq_queues.yml
+2
-2
ee/app/services/ee/groups/update_service.rb
ee/app/services/ee/groups/update_service.rb
+1
-1
spec/services/groups/update_service_spec.rb
spec/services/groups/update_service_spec.rb
+1
-1
spec/workers/disallow_two_factor_for_group_worker_spec.rb
spec/workers/disallow_two_factor_for_group_worker_spec.rb
+1
-1
spec/workers/disallow_two_factor_for_subgroups_worker_spec.rb
.../workers/disallow_two_factor_for_subgroups_worker_spec.rb
+3
-3
No files found.
app/services/groups/update_service.rb
View file @
e1f09138
...
...
@@ -99,11 +99,12 @@ module Groups
def
update_two_factor_requirement_for_subgroups
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
)
# enque in batches members update
DisallowTwoFaWorker
.
perform_async
(
group
.
id
)
DisallowTwoFa
ctorForSubgroups
Worker
.
perform_async
(
group
.
id
)
end
end
...
...
@@ -129,7 +130,7 @@ module Groups
end
def
allowed_settings_params
@allowed_settings_params
||=
SETTINGS_PARAMS
SETTINGS_PARAMS
end
def
valid_share_with_group_lock_change?
...
...
app/workers/all_queues.yml
View file @
e1f09138
...
...
@@ -1393,21 +1393,21 @@
:weight:
1
:idempotent:
:tags: []
-
:name: disallow_two_fa
-
:name: disallow_two_fa
ctor_for_group
:feature_category: :subgroups
:has_external_dependencies:
:urgency: :low
:resource_boundary: :unknown
:weight:
1
:idempotent:
:idempotent:
true
:tags: []
-
:name: disallow_two_fa_for_subgroups
-
:name: disallow_two_fa
ctor
_for_subgroups
:feature_category: :subgroups
:has_external_dependencies:
:urgency: :low
:resource_boundary: :unknown
:weight:
1
:idempotent:
:idempotent:
true
:tags: []
-
:name: email_receiver
:feature_category: :issue_tracking
...
...
app/workers/disallow_two_fa
_for_subgroups
_worker.rb
→
app/workers/disallow_two_fa
ctor_for_group
_worker.rb
View file @
e1f09138
# frozen_string_literal: true
class
DisallowTwoFa
ForSubgroupsWorker
# rubocop:disable Scalability/Idempotent
Worker
class
DisallowTwoFa
ctorForGroup
Worker
include
ApplicationWorker
include
ExceptionBacktrace
feature_category
:subgroups
idempotent!
def
perform
(
group_id
)
begin
...
...
app/workers/disallow_two_fa_worker.rb
→
app/workers/disallow_two_fa
ctor_for_subgroups
_worker.rb
View file @
e1f09138
# frozen_string_literal: true
class
DisallowTwoFa
Worker
# rubocop:disable Scalability/Idempotent
Worker
class
DisallowTwoFa
ctorForSubgroups
Worker
include
ApplicationWorker
include
ExceptionBacktrace
INTERVAL
=
2
.
seconds
.
to_i
feature_category
:subgroups
idempotent!
def
perform
(
group_id
)
begin
...
...
@@ -21,7 +22,7 @@ class DisallowTwoFaWorker # rubocop:disable Scalability/IdempotentWorker
delay
=
index
*
INTERVAL
with_context
(
namespace:
subgroup
)
do
DisallowTwoFa
ForSubgroups
Worker
.
perform_in
(
delay
,
subgroup
.
id
)
DisallowTwoFa
ctorForGroup
Worker
.
perform_in
(
delay
,
subgroup
.
id
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
config/sidekiq_queues.yml
View file @
e1f09138
...
...
@@ -84,9 +84,9 @@
-
1
-
-
detect_repository_languages
-
1
-
-
disallow_two_fa
-
-
disallow_two_fa
ctor_for_group
-
1
-
-
disallow_two_fa_for_subgroups
-
-
disallow_two_fa
ctor
_for_subgroups
-
1
-
-
elastic_commit_indexer
-
1
...
...
ee/app/services/ee/groups/update_service.rb
View file @
e1f09138
...
...
@@ -116,7 +116,7 @@ module EE
override
: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
def
log_audit_event
...
...
spec/services/groups/update_service_spec.rb
View file @
e1f09138
...
...
@@ -321,7 +321,7 @@ RSpec.describe Groups::UpdateService do
end
it
'enqueues update subgroups and its members'
do
expect
(
DisallowTwoFaWorker
).
to
receive
(
:perform_async
).
with
(
group
.
id
)
expect
(
DisallowTwoFa
ctorForSubgroups
Worker
).
to
receive
(
:perform_async
).
with
(
group
.
id
)
subject
end
...
...
spec/workers/disallow_two_fa
_for_subgroups
_worker_spec.rb
→
spec/workers/disallow_two_fa
ctor_for_group
_worker_spec.rb
View file @
e1f09138
...
...
@@ -2,7 +2,7 @@
require
'spec_helper'
RSpec
.
describe
DisallowTwoFa
ForSubgroups
Worker
do
RSpec
.
describe
DisallowTwoFa
ctorForGroup
Worker
do
let_it_be
(
:group
)
{
create
(
:group
,
require_two_factor_authentication:
true
)
}
let_it_be
(
:user
)
{
create
(
:user
,
require_two_factor_authentication_from_group:
true
)
}
...
...
spec/workers/disallow_two_fa_worker_spec.rb
→
spec/workers/disallow_two_fa
ctor_for_subgroups
_worker_spec.rb
View file @
e1f09138
...
...
@@ -2,15 +2,15 @@
require
'spec_helper'
RSpec
.
describe
DisallowTwoFaWorker
do
RSpec
.
describe
DisallowTwoFa
ctorForSubgroups
Worker
do
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_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
)
}
it
"schedules updating subgroups"
do
expect
(
DisallowTwoFa
ForSubgroups
Worker
).
to
receive
(
:perform_in
).
with
(
0
,
subgroup_with_2fa
.
id
)
expect
(
DisallowTwoFa
ForSubgroups
Worker
).
to
receive
(
:perform_in
).
with
(
2
,
subsubgroup_with_2fa
.
id
)
expect
(
DisallowTwoFa
ctorForGroup
Worker
).
to
receive
(
:perform_in
).
with
(
0
,
subgroup_with_2fa
.
id
)
expect
(
DisallowTwoFa
ctorForGroup
Worker
).
to
receive
(
:perform_in
).
with
(
2
,
subsubgroup_with_2fa
.
id
)
described_class
.
new
.
perform
(
group
.
id
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment