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
730e5853
Commit
730e5853
authored
Aug 11, 2020
by
Imre Farkas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCIM provisioning to avoid creating SCIM identity without membership
parent
f6e53638
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
ee/changelogs/unreleased/233137-scim_provisioning_avoid_identity_creation_without_membership.yml
...ovisioning_avoid_identity_creation_without_membership.yml
+5
-0
ee/lib/ee/gitlab/scim/provisioning_service.rb
ee/lib/ee/gitlab/scim/provisioning_service.rb
+1
-1
ee/spec/lib/ee/gitlab/scim/provisioning_service_spec.rb
ee/spec/lib/ee/gitlab/scim/provisioning_service_spec.rb
+22
-1
No files found.
ee/changelogs/unreleased/233137-scim_provisioning_avoid_identity_creation_without_membership.yml
0 → 100644
View file @
730e5853
---
title
:
SCIM provisioning to avoid creating SCIM identity without membership
merge_request
:
39259
author
:
type
:
fixed
ee/lib/ee/gitlab/scim/provisioning_service.rb
View file @
730e5853
...
...
@@ -39,7 +39,7 @@ module EE
end
def
create_identity_and_member
return
success_response
if
identity
.
save
&&
member
.
errors
.
empty?
return
success_response
if
member
.
valid?
&&
identity
.
save
error_response
(
objects:
[
identity
,
member
])
end
...
...
ee/spec/lib/ee/gitlab/scim/provisioning_service_spec.rb
View file @
730e5853
...
...
@@ -6,7 +6,12 @@ RSpec.describe ::EE::Gitlab::Scim::ProvisioningService do
describe
'#execute'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:service
)
{
described_class
.
new
(
group
,
service_params
)
}
let!
(
:saml_provider
)
{
create
(
:saml_provider
,
group:
group
,
default_membership_role:
Gitlab
::
Access
::
DEVELOPER
)
}
let
(
:enforced_sso
)
{
false
}
let!
(
:saml_provider
)
do
create
(
:saml_provider
,
group:
group
,
enforced_sso:
enforced_sso
,
default_membership_role:
Gitlab
::
Access
::
DEVELOPER
)
end
before
do
stub_licensed_features
(
group_saml:
true
)
...
...
@@ -195,6 +200,22 @@ RSpec.describe ::EE::Gitlab::Scim::ProvisioningService do
it
'creates the group member'
do
expect
{
service
.
execute
}.
to
change
{
GroupMember
.
count
}.
by
(
1
)
end
context
'with enforced SSO'
do
let
(
:enforced_sso
)
{
true
}
it
'does not create the group member'
do
expect
{
service
.
execute
}.
not_to
change
{
GroupMember
.
count
}
end
it
'does not create the SAML identity'
do
expect
{
service
.
execute
}.
not_to
change
{
Identity
.
count
}
end
it
'does not create the SCIM identity'
do
expect
{
service
.
execute
}.
not_to
change
{
ScimIdentity
.
count
}
end
end
end
context
'when user is an existing group member'
do
...
...
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