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
6f071f20
Commit
6f071f20
authored
May 03, 2021
by
Małgorzata Ksionek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cr remarks
parent
18c3f9a4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
3 deletions
+89
-3
ee/lib/gitlab/auth/group_saml/user.rb
ee/lib/gitlab/auth/group_saml/user.rb
+2
-1
ee/spec/features/groups/members/leave_group_spec.rb
ee/spec/features/groups/members/leave_group_spec.rb
+3
-2
ee/spec/models/ee/user_spec.rb
ee/spec/models/ee/user_spec.rb
+84
-0
No files found.
ee/lib/gitlab/auth/group_saml/user.rb
View file @
6f071f20
...
...
@@ -51,8 +51,9 @@ module Gitlab
override
:find_by_email
def
find_by_email
user
=
super
return
unless
user
&
.
authorized_by_provisioning_group?
(
saml_provider
.
group
)
return
user
if
user
&
.
authorized_by_provisioning_group?
(
saml_provider
.
group
)
user
end
override
:build_new_user
...
...
ee/spec/features/groups/members/leave_group_spec.rb
View file @
6f071f20
...
...
@@ -5,9 +5,10 @@ require 'spec_helper'
RSpec
.
describe
'Groups > Members > Leave group'
do
include
Spec
::
Support
::
Helpers
::
Features
::
MembersHelpers
let_it_be
(
:other_user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:other_user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
before
do
user
.
update!
(
provisioned_by_group:
group
)
...
...
ee/spec/models/ee/user_spec.rb
View file @
6f071f20
...
...
@@ -814,6 +814,90 @@ RSpec.describe User do
end
end
describe
'#user_authorized_by_provisioning_group?'
do
context
'when user is provisioned by group'
do
before
do
user
.
user_detail
.
provisioned_by_group
=
build
(
:group
)
end
it
'is true'
do
expect
(
user
.
user_authorized_by_provisioning_group?
).
to
eq
true
end
context
'with feature flag switched off'
do
before
do
stub_feature_flags
(
block_password_auth_for_saml_users:
false
)
end
it
'is false'
do
expect
(
user
.
user_authorized_by_provisioning_group?
).
to
eq
false
end
end
end
context
'when user is not provisioned by group'
do
it
'is false'
do
expect
(
user
.
user_authorized_by_provisioning_group?
).
to
eq
false
end
context
'with feature flag switched off'
do
before
do
stub_feature_flags
(
block_password_auth_for_saml_users:
false
)
end
it
'is false'
do
expect
(
user
.
user_authorized_by_provisioning_group?
).
to
eq
false
end
end
end
end
describe
'#authorized_by_provisioning_group?'
do
let_it_be
(
:group
)
{
create
(
:group
)
}
context
'when user is provisioned by group'
do
before
do
user
.
user_detail
.
provisioned_by_group
=
group
end
it
'is true'
do
expect
(
user
.
authorized_by_provisioning_group?
(
group
)).
to
eq
true
end
context
'when other group is provided'
do
it
'is false'
do
expect
(
user
.
authorized_by_provisioning_group?
(
create
(
:group
))).
to
eq
false
end
end
context
'with feature flag switched off'
do
before
do
stub_feature_flags
(
block_password_auth_for_saml_users:
false
)
end
it
'is false'
do
expect
(
user
.
authorized_by_provisioning_group?
(
group
)).
to
eq
false
end
end
end
context
'when user is not provisioned by group'
do
it
'is false'
do
expect
(
user
.
authorized_by_provisioning_group?
(
group
)).
to
eq
false
end
context
'with feature flag switched off'
do
before
do
stub_feature_flags
(
block_password_auth_for_saml_users:
false
)
end
it
'is false'
do
expect
(
user
.
authorized_by_provisioning_group?
(
group
)).
to
eq
false
end
end
end
end
describe
'#using_license_seat?'
do
let
(
:user
)
{
create
(
:user
)
}
...
...
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