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
f7aba277
Commit
f7aba277
authored
Sep 30, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to gitlab config to specify if LDAP server is active directory.
parent
0c29cb34
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
1 deletion
+25
-1
config/gitlab.yml.example
config/gitlab.yml.example
+6
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-0
lib/gitlab/ldap/access.rb
lib/gitlab/ldap/access.rb
+3
-1
spec/lib/gitlab/ldap/access_spec.rb
spec/lib/gitlab/ldap/access_spec.rb
+15
-0
No files found.
config/gitlab.yml.example
View file @
f7aba277
...
@@ -140,6 +140,12 @@ production: &base
...
@@ -140,6 +140,12 @@ production: &base
method: 'ssl' # "tls" or "ssl" or "plain"
method: 'ssl' # "tls" or "ssl" or "plain"
bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
password: '_the_password_of_the_bind_user'
password: '_the_password_of_the_bind_user'
# This setting specifies if LDAP server is Active Directory LDAP server.
# For non AD servers it skips the AD specific queries.
# If your LDAP server is not AD, set this to false.
active_directory: true
# If allow_username_or_email_login is enabled, GitLab will ignore everything
# If allow_username_or_email_login is enabled, GitLab will ignore everything
# after the first '@' in the LDAP username submitted by the user on login.
# after the first '@' in the LDAP username submitted by the user on login.
#
#
...
...
config/initializers/1_settings.rb
View file @
f7aba277
...
@@ -57,6 +57,7 @@ end
...
@@ -57,6 +57,7 @@ end
Settings
[
'ldap'
]
||=
Settingslogic
.
new
({})
Settings
[
'ldap'
]
||=
Settingslogic
.
new
({})
Settings
.
ldap
[
'enabled'
]
=
false
if
Settings
.
ldap
[
'enabled'
].
nil?
Settings
.
ldap
[
'enabled'
]
=
false
if
Settings
.
ldap
[
'enabled'
].
nil?
Settings
.
ldap
[
'allow_username_or_email_login'
]
=
false
if
Settings
.
ldap
[
'allow_username_or_email_login'
].
nil?
Settings
.
ldap
[
'allow_username_or_email_login'
]
=
false
if
Settings
.
ldap
[
'allow_username_or_email_login'
].
nil?
Settings
.
ldap
[
'active_directory'
]
=
true
if
Settings
.
ldap
[
'active_directory'
].
nil?
Settings
[
'omniauth'
]
||=
Settingslogic
.
new
({})
Settings
[
'omniauth'
]
||=
Settingslogic
.
new
({})
...
...
lib/gitlab/ldap/access.rb
View file @
f7aba277
...
@@ -28,7 +28,9 @@ module Gitlab
...
@@ -28,7 +28,9 @@ module Gitlab
def
allowed?
(
user
)
def
allowed?
(
user
)
if
Gitlab
::
LDAP
::
Person
.
find_by_dn
(
user
.
extern_uid
,
adapter
)
if
Gitlab
::
LDAP
::
Person
.
find_by_dn
(
user
.
extern_uid
,
adapter
)
if
Gitlab
.
config
.
ldap
.
active_directory
!
Gitlab
::
LDAP
::
Person
.
disabled_via_active_directory?
(
user
.
extern_uid
,
adapter
)
!
Gitlab
::
LDAP
::
Person
.
disabled_via_active_directory?
(
user
.
extern_uid
,
adapter
)
end
else
else
false
false
end
end
...
...
spec/lib/gitlab/ldap/access_spec.rb
View file @
f7aba277
...
@@ -27,6 +27,21 @@ describe Gitlab::LDAP::Access do
...
@@ -27,6 +27,21 @@ describe Gitlab::LDAP::Access do
it
{
should
be_true
}
it
{
should
be_true
}
end
end
context
'and has no disabled flag in active diretory'
do
before
{
Gitlab
::
LDAP
::
Person
.
stub
(
disabled_via_active_directory?:
false
)
Gitlab
.
config
.
ldap
[
'enabled'
]
=
true
Gitlab
.
config
.
ldap
[
'active_directory'
]
=
false
}
after
{
Gitlab
.
config
.
ldap
[
'enabled'
]
=
false
Gitlab
.
config
.
ldap
[
'active_directory'
]
=
true
}
it
{
should
be_false
}
end
end
end
end
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