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
104e1462
Commit
104e1462
authored
Oct 16, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-multi-ldap-servers-group-sync' into feature-migrate-to-multiple-ldaps
parents
f4c64d44
0ebe09e4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
15 deletions
+17
-15
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+4
-1
config/initializers/7_omniauth.rb
config/initializers/7_omniauth.rb
+12
-10
config/initializers/devise.rb
config/initializers/devise.rb
+1
-1
lib/api/ldap.rb
lib/api/ldap.rb
+0
-3
No files found.
config/initializers/1_settings.rb
View file @
104e1462
...
...
@@ -61,6 +61,7 @@ Settings.ldap['sync_time'] = 3600 if Settings.ldap['sync_time'].nil?
if
Settings
.
ldap
[
'enabled'
]
||
Rails
.
env
.
test?
if
Settings
.
ldap
[
'host'
].
present?
server
=
Settings
.
ldap
.
except
(
'sync_time'
)
server
=
Settingslogic
.
new
(
server
)
server
[
'label'
]
=
'LDAP'
server
[
'provider_name'
]
=
'ldap'
Settings
.
ldap
[
'servers'
]
=
{
...
...
@@ -68,12 +69,14 @@ if Settings.ldap['enabled'] || Rails.env.test?
}
end
Settings
.
ldap
[
'servers'
].
each
do
|
key
,
server
|
Settings
.
ldap
[
'servers'
].
map
do
|
key
,
server
|
server
=
Settingslogic
.
new
(
server
)
server
[
'allow_username_or_email_login'
]
=
false
if
server
[
'allow_username_or_email_login'
].
nil?
server
[
'active_directory'
]
=
true
if
server
[
'active_directory'
].
nil?
server
[
'provider_name'
]
||=
"ldap
#{
key
}
"
.
downcase
server
[
'sync_time'
]
=
3600
if
server
[
'sync_time'
].
nil?
server
[
'provider_class'
]
=
OmniAuth
::
Utils
.
camelize
(
server
[
'provider_name'
])
Settings
.
ldap
[
'servers'
][
key
]
=
server
end
end
...
...
config/initializers/7_omniauth.rb
View file @
104e1462
module
OmniAuth::Strategies
Gitlab
::
LDAP
::
Config
.
servers
.
each
do
|
server
|
# do not redeclare LDAP
next
if
server
[
'provider_name'
]
==
'ldap'
const_set
(
server
[
'provider_class'
],
Class
.
new
(
LDAP
))
if
Gitlab
::
LDAP
::
Config
.
enabled?
module
OmniAuth::Strategies
Gitlab
::
LDAP
::
Config
.
servers
.
each
do
|
server
|
# do not redeclare LDAP
next
if
server
[
'provider_name'
]
==
'ldap'
const_set
(
server
[
'provider_class'
],
Class
.
new
(
LDAP
))
end
end
end
OmniauthCallbacksController
.
class_eval
do
Gitlab
::
LDAP
::
Config
.
servers
.
each
do
|
server
|
alias_method
server
[
'provider_name'
],
:ldap
OmniauthCallbacksController
.
class_eval
do
Gitlab
::
LDAP
::
Config
.
servers
.
each
do
|
server
|
alias_method
server
[
'provider_name'
],
:ldap
end
end
end
end
\ No newline at end of file
config/initializers/devise.rb
View file @
104e1462
...
...
@@ -204,7 +204,7 @@ Devise.setup do |config|
# manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
if
Gitlab
.
config
.
ldap
.
enabled
if
Gitlab
::
LDAP
::
Config
.
enabled?
Gitlab
::
LDAP
::
Config
.
servers
.
each
do
|
server
|
if
server
[
'allow_username_or_email_login'
]
email_stripping_proc
=
->
(
name
)
{
name
.
gsub
(
/@.*$/
,
''
)}
...
...
lib/api/ldap.rb
View file @
104e1462
...
...
@@ -28,9 +28,6 @@ module API
# GET /ldap/ldapmain/groups
get
':provider/groups'
do
@groups
=
get_group_list
(
params
[
:provider
],
params
[
:search
])
# NOTE: this should be deprecated in favour of /ldap/PROVIDER_NAME/groups
# for now we just select the first LDAP server
present
@groups
,
with:
Entities
::
LdapGroup
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