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
Show 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
...
@@ -23,12 +23,7 @@ class SessionsController < Devise::SessionsController
def
new
def
new
set_minimum_password_length
set_minimum_password_length
@ldap_servers
=
@ldap_servers
=
Gitlab
::
LDAP
::
Config
.
available_servers
if
Gitlab
.
config
.
ldap
.
enabled
Gitlab
::
LDAP
::
Config
.
servers
else
[]
end
super
super
end
end
...
...
config/initializers/omniauth.rb
View file @
ef97cb54
if
Gitlab
::
LDAP
::
Config
.
enabled?
if
Gitlab
::
LDAP
::
Config
.
enabled?
module
OmniAuth::Strategies
module
OmniAuth::Strategies
server
=
Gitlab
.
config
.
ldap
.
servers
.
values
.
first
Gitlab
::
LDAP
::
Config
.
available_servers
.
each
do
|
server
|
klass
=
server
[
'provider_class'
]
# do not redeclare LDAP
const_set
(
klass
,
Class
.
new
(
LDAP
))
unless
klass
==
'LDAP'
next
if
server
[
'provider_name'
]
==
'ldap'
const_set
(
server
[
'provider_class'
],
Class
.
new
(
LDAP
))
end
end
end
OmniauthCallbacksController
.
class_eval
do
OmniauthCallbacksController
.
class_eval
do
server
=
Gitlab
.
config
.
ldap
.
servers
.
values
.
first
Gitlab
::
LDAP
::
Config
.
available_servers
.
each
do
|
server
|
alias_method
server
[
'provider_name'
],
:ldap
alias_method
server
[
'provider_name'
],
:ldap
end
end
end
end
end
OmniAuth
.
config
.
full_host
=
Settings
.
gitlab
[
'base_url'
]
OmniAuth
.
config
.
full_host
=
Settings
.
gitlab
[
'base_url'
]
...
...
lib/gitlab/ldap/config.rb
View file @
ef97cb54
...
@@ -18,6 +18,12 @@ module Gitlab
...
@@ -18,6 +18,12 @@ module Gitlab
Gitlab
.
config
.
ldap
.
servers
.
values
Gitlab
.
config
.
ldap
.
servers
.
values
end
end
def
self
.
available_servers
return
[]
unless
enabled?
Array
.
wrap
(
servers
.
first
)
end
def
self
.
providers
def
self
.
providers
servers
.
map
{
|
server
|
server
[
'provider_name'
]
}
servers
.
map
{
|
server
|
server
[
'provider_name'
]
}
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