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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
1c3a2bc3
Commit
1c3a2bc3
authored
Aug 17, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setup LDAP settings properly
parent
f3203cbb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+4
-0
spec/initializers/settings_spec.rb
spec/initializers/settings_spec.rb
+16
-0
No files found.
config/initializers/1_settings.rb
View file @
1c3a2bc3
...
@@ -139,6 +139,8 @@ if Settings.ldap['enabled'] || Rails.env.test?
...
@@ -139,6 +139,8 @@ if Settings.ldap['enabled'] || Rails.env.test?
end
end
Settings
.
ldap
[
'servers'
].
each
do
|
key
,
server
|
Settings
.
ldap
[
'servers'
].
each
do
|
key
,
server
|
server
=
Settingslogic
.
new
(
server
)
server
[
'label'
]
||=
'LDAP'
server
[
'label'
]
||=
'LDAP'
server
[
'timeout'
]
||=
10
.
seconds
server
[
'timeout'
]
||=
10
.
seconds
server
[
'block_auto_created_users'
]
=
false
if
server
[
'block_auto_created_users'
].
nil?
server
[
'block_auto_created_users'
]
=
false
if
server
[
'block_auto_created_users'
].
nil?
...
@@ -165,6 +167,8 @@ if Settings.ldap['enabled'] || Rails.env.test?
...
@@ -165,6 +167,8 @@ if Settings.ldap['enabled'] || Rails.env.test?
MSG
MSG
Rails
.
logger
.
warn
(
message
)
Rails
.
logger
.
warn
(
message
)
end
end
Settings
.
ldap
[
'servers'
][
key
]
=
server
end
end
end
end
...
...
spec/initializers/settings_spec.rb
View file @
1c3a2bc3
...
@@ -2,6 +2,22 @@ require 'spec_helper'
...
@@ -2,6 +2,22 @@ require 'spec_helper'
require_relative
'../../config/initializers/1_settings'
require_relative
'../../config/initializers/1_settings'
describe
Settings
do
describe
Settings
do
describe
'#ldap'
do
it
'can be accessed with dot syntax all the way down'
do
expect
(
Gitlab
.
config
.
ldap
.
servers
.
main
.
label
).
to
eq
(
'ldap'
)
end
# Specifically trying to cause this error discovered in EE when removing the
# reassignment of each server element with Settingslogic.
#
# `undefined method `label' for #<Hash:0x007fbd18b59c08>`
#
it
'can be accessed in a very specific way that breaks without reassigning each element with Settingslogic'
do
server_settings
=
Gitlab
.
config
.
ldap
.
servers
[
'main'
]
expect
(
server_settings
.
label
).
to
eq
(
'ldap'
)
end
end
describe
'#repositories'
do
describe
'#repositories'
do
it
'assigns the default failure attributes'
do
it
'assigns the default failure attributes'
do
repository_settings
=
Gitlab
.
config
.
repositories
.
storages
[
'broken'
]
repository_settings
=
Gitlab
.
config
.
repositories
.
storages
[
'broken'
]
...
...
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