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
07de7bca
Commit
07de7bca
authored
Jul 29, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add group base to config. Join auth options only if provided
parent
f9f1649f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
config/gitlab.yml.example
config/gitlab.yml.example
+13
-1
lib/gitlab/ldap.rb
lib/gitlab/ldap.rb
+12
-3
No files found.
config/gitlab.yml.example
View file @
07de7bca
...
...
@@ -91,7 +91,6 @@ production: &base
ldap:
enabled: false
host: '_your_ldap_server'
base: '_the_base_where_you_search_for_users'
port: 636
uid: 'sAMAccountName'
method: 'ssl' # "ssl" or "plain"
...
...
@@ -99,6 +98,19 @@ production: &base
password: '_the_password_of_the_bind_user'
allow_username_or_email_login: true
# Base where we can search for users
#
# Ex. ou=People,dc=gitlab,dc=example
#
base: ''
# Base where we can search for groups
#
# Ex. ou=Groups,dc=gitlab,dc=example
#
group_base: ''
## OmniAuth settings
omniauth:
# Allow login via Twitter, Google, etc. using OmniAuth providers
...
...
lib/gitlab/ldap.rb
View file @
07de7bca
...
...
@@ -3,15 +3,24 @@ module Gitlab
attr_reader
:ldap
def
initialize
@ldap
=
Net
::
LDAP
.
new
(
options
=
{
host:
config
[
'host'
],
port:
config
[
'port'
],
}
auth_options
=
{
auth:
{
method:
config
[
'method'
],
username:
config
[
'bind_dn'
],
password:
config
[
'password'
]
}
)
}
if
config
[
'password'
]
||
config
[
'bind_dn'
]
options
.
merge!
(
auth_options
)
end
@ldap
=
Net
::
LDAP
.
new
(
options
)
end
# Get LDAP groups from ou=Groups
...
...
@@ -23,7 +32,7 @@ module Gitlab
#
def
groups
(
cn
=
"*"
)
options
=
{
base:
"ou=Groups,
#{
config
[
'base'
]
}
"
,
base:
config
[
'group_base'
]
,
filter:
Net
::
LDAP
::
Filter
.
eq
(
"cn"
,
cn
)
}
...
...
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