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
80306c45
Commit
80306c45
authored
Dec 30, 2019
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support new Azure SCIM pre-setup check
parent
df21f58e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
ee/app/finders/scim_finder.rb
ee/app/finders/scim_finder.rb
+11
-0
ee/changelogs/unreleased/jej-fix-azure-scim-pre-check.yml
ee/changelogs/unreleased/jej-fix-azure-scim-pre-check.yml
+5
-0
ee/spec/finders/scim_finder_spec.rb
ee/spec/finders/scim_finder_spec.rb
+5
-1
No files found.
ee/app/finders/scim_finder.rb
View file @
80306c45
...
...
@@ -27,6 +27,8 @@ class ScimFinder
if
eq_filter_on_extern_uid?
(
parser
)
by_extern_uid
(
parser
)
elsif
eq_filter_on_username?
(
parser
)
by_username
(
parser
)
else
raise
UnsupportedFilter
end
...
...
@@ -39,4 +41,13 @@ class ScimFinder
def
by_extern_uid
(
parser
)
Identity
.
where_group_saml_uid
(
saml_provider
,
parser
.
filter_params
[
:extern_uid
])
end
def
eq_filter_on_username?
(
parser
)
parser
.
filter_operator
==
:eq
&&
parser
.
filter_params
[
:username
].
present?
end
def
by_username
(
parser
)
user
=
User
.
find_by_username
(
parser
.
filter_params
[
:username
])
saml_provider
.
identities
.
for_user
(
user
)
end
end
ee/changelogs/unreleased/jej-fix-azure-scim-pre-check.yml
0 → 100644
View file @
80306c45
---
title
:
Support new Azure SCIM pre-setup check
merge_request
:
22348
author
:
type
:
fixed
ee/spec/finders/scim_finder_spec.rb
View file @
80306c45
...
...
@@ -37,6 +37,10 @@ describe ScimFinder do
expect
(
finder
.
search
(
filter:
"id eq
#{
identity
.
extern_uid
}
"
).
first
).
to
eq
identity
expect
(
finder
.
search
(
filter:
"externalId eq
#{
identity
.
extern_uid
}
"
).
first
).
to
eq
identity
end
it
'allows lookup by userName'
do
expect
(
finder
.
search
(
filter:
"userName eq
\"
#{
identity
.
user
.
username
}
\"
"
).
first
).
to
eq
identity
end
end
it
'returns all related identities if there is no filter'
do
...
...
@@ -50,7 +54,7 @@ describe ScimFinder do
end
it
'raises an error if the attribute path is unsupported'
do
expect
{
finder
.
search
(
filter:
'
user
Name eq "name"'
).
count
}.
to
raise_error
(
ScimFinder
::
UnsupportedFilter
)
expect
{
finder
.
search
(
filter:
'
display
Name eq "name"'
).
count
}.
to
raise_error
(
ScimFinder
::
UnsupportedFilter
)
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