BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
sessions_controller.rb
app/controllers/sessions_controller.rb
+1
-6
omniauth.rb
config/initializers/omniauth.rb
+8
-5
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