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
959e4fab
Commit
959e4fab
authored
Nov 04, 2020
by
Gosia Ksionek
Committed by
Imre Farkas
Nov 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve User stuck in 2FA setup page even if group disable 2FA enforce
parent
1383abb6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
12 deletions
+66
-12
app/models/group.rb
app/models/group.rb
+1
-1
changelogs/unreleased/220433-user-stuck-in-2fa-setup-page-even-if-group-disable-2fa-enforce.yml
...k-in-2fa-setup-page-even-if-group-disable-2fa-enforce.yml
+5
-0
spec/models/group_spec.rb
spec/models/group_spec.rb
+60
-11
No files found.
app/models/group.rb
View file @
959e4fab
...
...
@@ -587,7 +587,7 @@ class Group < Namespace
def
update_two_factor_requirement
return
unless
saved_change_to_require_two_factor_authentication?
||
saved_change_to_two_factor_grace_period?
members_with_descendant
s
.
find_each
(
&
:update_two_factor_requirement
)
direct_and_indirect_member
s
.
find_each
(
&
:update_two_factor_requirement
)
end
def
path_changed_hook
...
...
changelogs/unreleased/220433-user-stuck-in-2fa-setup-page-even-if-group-disable-2fa-enforce.yml
0 → 100644
View file @
959e4fab
---
title
:
Resolve User stuck in 2FA setup page even if group disable 2FA enforce
merge_request
:
46432
author
:
type
:
fixed
spec/models/group_spec.rb
View file @
959e4fab
...
...
@@ -967,23 +967,72 @@ RSpec.describe Group do
context
'expanded group members'
do
let
(
:indirect_user
)
{
create
(
:user
)
}
it
'enables two_factor_requirement for subgroup member'
do
subgroup
=
create
(
:group
,
:nested
,
parent:
group
)
subgroup
.
add_user
(
indirect_user
,
GroupMember
::
OWNER
)
context
'two_factor_requirement is enabled'
do
context
'two_factor_requirement is also enabled for ancestor group'
do
it
'enables two_factor_requirement for subgroup member'
do
subgroup
=
create
(
:group
,
:nested
,
parent:
group
)
subgroup
.
add_user
(
indirect_user
,
GroupMember
::
OWNER
)
group
.
update!
(
require_two_factor_authentication:
true
)
group
.
update!
(
require_two_factor_authentication:
true
)
expect
(
indirect_user
.
reload
.
require_two_factor_authentication_from_group
).
to
be_truthy
end
end
context
'two_factor_requirement is disabled for ancestor group'
do
it
'enables two_factor_requirement for subgroup member'
do
subgroup
=
create
(
:group
,
:nested
,
parent:
group
,
require_two_factor_authentication:
true
)
subgroup
.
add_user
(
indirect_user
,
GroupMember
::
OWNER
)
group
.
update!
(
require_two_factor_authentication:
false
)
expect
(
indirect_user
.
reload
.
require_two_factor_authentication_from_group
).
to
be_truthy
expect
(
indirect_user
.
reload
.
require_two_factor_authentication_from_group
).
to
be_truthy
end
it
'enable two_factor_requirement for ancestor group member'
do
ancestor_group
=
create
(
:group
)
ancestor_group
.
add_user
(
indirect_user
,
GroupMember
::
OWNER
)
group
.
update!
(
parent:
ancestor_group
)
group
.
update!
(
require_two_factor_authentication:
true
)
expect
(
indirect_user
.
reload
.
require_two_factor_authentication_from_group
).
to
be_truthy
end
end
end
it
'does not enable two_factor_requirement for ancestor group member'
do
ancestor_group
=
create
(
:group
)
ancestor_group
.
add_user
(
indirect_user
,
GroupMember
::
OWNER
)
group
.
update!
(
parent:
ancestor_group
)
context
'two_factor_requirement is disabled'
do
context
'two_factor_requirement is enabled for ancestor group'
do
it
'enables two_factor_requirement for subgroup member'
do
subgroup
=
create
(
:group
,
:nested
,
parent:
group
)
subgroup
.
add_user
(
indirect_user
,
GroupMember
::
OWNER
)
group
.
update!
(
require_two_factor_authentication:
true
)
group
.
update!
(
require_two_factor_authentication:
true
)
expect
(
indirect_user
.
reload
.
require_two_factor_authentication_from_group
).
to
be_truthy
end
end
context
'two_factor_requirement is also disabled for ancestor group'
do
it
'disables two_factor_requirement for subgroup member'
do
subgroup
=
create
(
:group
,
:nested
,
parent:
group
)
subgroup
.
add_user
(
indirect_user
,
GroupMember
::
OWNER
)
group
.
update!
(
require_two_factor_authentication:
false
)
expect
(
indirect_user
.
reload
.
require_two_factor_authentication_from_group
).
to
be_falsey
expect
(
indirect_user
.
reload
.
require_two_factor_authentication_from_group
).
to
be_falsey
end
it
'disables two_factor_requirement for ancestor group member'
do
ancestor_group
=
create
(
:group
,
require_two_factor_authentication:
false
)
indirect_user
.
update!
(
require_two_factor_authentication_from_group:
true
)
ancestor_group
.
add_user
(
indirect_user
,
GroupMember
::
OWNER
)
group
.
update!
(
require_two_factor_authentication:
false
)
expect
(
indirect_user
.
reload
.
require_two_factor_authentication_from_group
).
to
be_falsey
end
end
end
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