BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
af53aa90
Commit
af53aa90
authored
Mar 14, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Gitlab::LDAP::Adapter.open
This new method is based on Net::LDAP.open, which reuses a single LDAP connection.
parent
5a616649
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
adapter.rb
lib/gitlab/ldap/adapter.rb
+17
-3
No files found.
lib/gitlab/ldap/adapter.rb
View file @
af53aa90
...
...
@@ -3,7 +3,17 @@ module Gitlab
class
Adapter
attr_reader
:ldap
def
initialize
def
self
.
open
(
&
block
)
Net
::
LDAP
.
open
(
adapter_options
)
do
|
ldap
|
block
.
call
(
self
.
new
(
ldap
))
end
end
def
self
.
config
Gitlab
.
config
.
ldap
end
def
self
.
adapter_options
encryption
=
config
[
'method'
].
to_s
==
'ssl'
?
:
simple_tls
:
nil
options
=
{
...
...
@@ -23,8 +33,12 @@ module Gitlab
if
config
[
'password'
]
||
config
[
'bind_dn'
]
options
.
merge!
(
auth_options
)
end
options
end
@ldap
=
Net
::
LDAP
.
new
(
options
)
def
initialize
(
ldap
=
nil
)
@ldap
=
ldap
||
Net
::
LDAP
.
new
(
self
.
class
.
adapter_options
)
end
def
users
(
field
,
value
)
...
...
@@ -65,7 +79,7 @@ module Gitlab
private
def
config
@config
||=
Gitlab
.
config
.
ldap
@config
||=
self
.
class
.
config
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