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
cd85a558
Commit
cd85a558
authored
Sep 25, 2017
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creates compound query for LDAP email attributes.
parent
718e5b08
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
lib/gitlab/ldap/adapter.rb
lib/gitlab/ldap/adapter.rb
+14
-6
lib/gitlab/ldap/person.rb
lib/gitlab/ldap/person.rb
+1
-1
No files found.
lib/gitlab/ldap/adapter.rb
View file @
cd85a558
...
...
@@ -73,19 +73,27 @@ module Gitlab
private
def
user_options
(
field
,
value
,
limit
)
options
=
{
attributes:
Gitlab
::
LDAP
::
Person
.
ldap_attributes
(
config
).
compact
.
uniq
}
filter
=
nil
options
=
{
attributes:
Gitlab
::
LDAP
::
Person
.
ldap_attributes
(
config
).
compact
.
uniq
,
base:
config
.
base
}
options
[
:size
]
=
limit
if
limit
if
field
.
to_sym
==
:dn
case
field
.
to_sym
when
:dn
options
[
:base
]
=
value
options
[
:scope
]
=
Net
::
LDAP
::
SearchScope_BaseObject
options
[
:filter
]
=
user_filter
when
:email
filter
=
config
.
attributes
[
'email'
].
map
do
|
field
|
Net
::
LDAP
::
Filter
.
eq
(
field
,
value
)
end
.
inject
(
:|
)
else
options
[
:base
]
=
config
.
base
options
[
:filter
]
=
user_filter
(
Net
::
LDAP
::
Filter
.
eq
(
field
,
value
))
filter
=
Net
::
LDAP
::
Filter
.
eq
(
field
,
value
)
end
options
options
.
merge
(
filter:
user_filter
(
filter
))
end
def
user_filter
(
filter
=
nil
)
...
...
lib/gitlab/ldap/person.rb
View file @
cd85a558
...
...
@@ -18,7 +18,7 @@ module Gitlab
end
def
self
.
find_by_email
(
email
,
adapter
)
Array
(
adapter
.
config
.
attributes
[
'email'
]).
find
{
|
attr
|
adapter
.
user
(
attr
,
email
)
}
adapter
.
user
(
'email'
,
email
)
end
def
self
.
disabled_via_active_directory?
(
dn
,
adapter
)
...
...
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