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
1fe67799
Commit
1fe67799
authored
Apr 15, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LDAP::Adapter#ldap_search method
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
4bcc244b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
lib/gitlab/ldap/adapter.rb
lib/gitlab/ldap/adapter.rb
+20
-4
lib/gitlab/ldap/person.rb
lib/gitlab/ldap/person.rb
+1
-1
No files found.
lib/gitlab/ldap/adapter.rb
View file @
1fe67799
...
...
@@ -62,7 +62,7 @@ module Gitlab
options
.
merge!
(
size:
size
)
if
size
ldap
.
search
(
options
).
map
do
|
entry
|
ldap
_
search
(
options
).
map
do
|
entry
|
Gitlab
::
LDAP
::
Group
.
new
(
entry
,
self
)
end
end
...
...
@@ -93,7 +93,7 @@ module Gitlab
end
end
entries
=
ldap
.
search
(
options
).
select
do
|
entry
|
entries
=
ldap
_
search
(
options
).
select
do
|
entry
|
entry
.
respond_to?
config
.
uid
end
...
...
@@ -107,14 +107,30 @@ module Gitlab
end
def
dn_matches_filter?
(
dn
,
filter
)
results
=
ldap
.
search
(
base:
dn
,
filter:
filter
,
attributes:
%w{dn}
)
if
results
.
nil
?
results
=
ldap
_
search
(
base:
dn
,
filter:
filter
,
attributes:
%w{dn}
)
if
results
.
blank
?
false
# Net::LDAP encountered an LDAP error
else
results
.
any?
end
end
def
ldap_search
(
*
args
)
results
=
ldap
.
search
(
*
args
)
if
results
.
nil?
response
=
ldap
.
get_operation_result
unless
response
.
code
.
zero?
Rails
.
logger
.
warn
(
"LDAP search error:
#{
response
.
message
}
"
)
end
[]
else
results
end
end
private
def
config
...
...
lib/gitlab/ldap/person.rb
View file @
1fe67799
...
...
@@ -9,7 +9,7 @@ module Gitlab
class
Person
def
self
.
find_by_uid
(
uid
,
adapter
=
nil
)
adapter
||=
Gitlab
::
LDAP
::
Adapter
.
new
adapter
.
user
(
config
.
uid
,
uid
)
adapter
.
user
(
Gitlab
.
config
.
ldap
.
uid
,
uid
)
end
def
self
.
find_by_dn
(
dn
,
adapter
=
nil
)
...
...
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