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
Léo-Paul Géneau
gitlab-ce
Commits
ef97cb54
Commit
ef97cb54
authored
Jul 26, 2017
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport some recent changes related to LDAP from EE
parent
4eebd8e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
app/controllers/sessions_controller.rb
app/controllers/sessions_controller.rb
+1
-6
config/initializers/omniauth.rb
config/initializers/omniauth.rb
+8
-5
lib/gitlab/ldap/config.rb
lib/gitlab/ldap/config.rb
+6
-0
No files found.
app/controllers/sessions_controller.rb
View file @
ef97cb54
...
...
@@ -23,12 +23,7 @@ class SessionsController < Devise::SessionsController
def
new
set_minimum_password_length
@ldap_servers
=
if
Gitlab
.
config
.
ldap
.
enabled
Gitlab
::
LDAP
::
Config
.
servers
else
[]
end
@ldap_servers
=
Gitlab
::
LDAP
::
Config
.
available_servers
super
end
...
...
config/initializers/omniauth.rb
View file @
ef97cb54
if
Gitlab
::
LDAP
::
Config
.
enabled?
module
OmniAuth::Strategies
server
=
Gitlab
.
config
.
ldap
.
servers
.
values
.
first
klass
=
server
[
'provider_class'
]
const_set
(
klass
,
Class
.
new
(
LDAP
))
unless
klass
==
'LDAP'
Gitlab
::
LDAP
::
Config
.
available_servers
.
each
do
|
server
|
# do not redeclare LDAP
next
if
server
[
'provider_name'
]
==
'ldap'
const_set
(
server
[
'provider_class'
],
Class
.
new
(
LDAP
))
end
end
OmniauthCallbacksController
.
class_eval
do
server
=
Gitlab
.
config
.
ldap
.
servers
.
values
.
first
alias_method
server
[
'provider_name'
],
:ldap
Gitlab
::
LDAP
::
Config
.
available_servers
.
each
do
|
server
|
alias_method
server
[
'provider_name'
],
:ldap
end
end
end
...
...
lib/gitlab/ldap/config.rb
View file @
ef97cb54
...
...
@@ -18,6 +18,12 @@ module Gitlab
Gitlab
.
config
.
ldap
.
servers
.
values
end
def
self
.
available_servers
return
[]
unless
enabled?
Array
.
wrap
(
servers
.
first
)
end
def
self
.
providers
servers
.
map
{
|
server
|
server
[
'provider_name'
]
}
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