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
d9355ea5
Commit
d9355ea5
authored
Oct 03, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow proper provider_name for ldap provider
parent
97aa12fc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
16 deletions
+21
-16
app/controllers/omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+1
-1
app/views/devise/sessions/new.html.haml
app/views/devise/sessions/new.html.haml
+3
-3
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+14
-8
config/initializers/7_omniauth.rb
config/initializers/7_omniauth.rb
+2
-3
config/initializers/devise.rb
config/initializers/devise.rb
+1
-1
No files found.
app/controllers/omniauth_callbacks_controller.rb
View file @
d9355ea5
...
...
@@ -33,7 +33,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
end
Gitlab
.
config
.
ldap
.
servers
.
each
do
|
server
|
alias_method
"ldap
#{
server
.
index
}
"
,
:ldap
alias_method
server
.
provider_name
,
:ldap
end
def
omniauth_error
...
...
app/views/devise/sessions/new.html.haml
View file @
d9355ea5
...
...
@@ -6,13 +6,13 @@
%ul
.nav.nav-tabs
-
@ldap_servers
.
each
do
|
server
|
%li
{
class:
(
:active
if
server
[
'primary'
])}
=
link_to
server
[
'label'
],
"#tab-
ldap
#{
server
.
index
}
"
,
'data-toggle'
=>
'tab'
=
link_to
server
[
'label'
],
"#tab-
#{
server
.
provider_name
}
"
,
'data-toggle'
=>
'tab'
%li
=
link_to
'Standard'
,
'#tab-signin'
,
'data-toggle'
=>
'tab'
.tab-content
-
@ldap_servers
.
each
do
|
server
|
%div
.tab-pane
{
id:
"tab-
ldap#{server.index
}"
,
class:
(
:active
if
server
[
'primary'
])}
=
render
'devise/sessions/new_ldap'
,
provider:
"ldap
#{
server
.
index
}
"
%div
.tab-pane
{
id:
"tab-
#{server.provider_name
}"
,
class:
(
:active
if
server
[
'primary'
])}
=
render
'devise/sessions/new_ldap'
,
provider:
server
.
provider_name
%div
#tab-signin
.tab-pane
=
render
'devise/sessions/new_base'
...
...
config/initializers/1_settings.rb
View file @
d9355ea5
...
...
@@ -52,7 +52,6 @@ class Settings < Settingslogic
end
end
# Default settings
Settings
[
'ldap'
]
||=
Settingslogic
.
new
({})
Settings
.
ldap
[
'enabled'
]
=
false
if
Settings
.
ldap
[
'enabled'
].
nil?
...
...
@@ -60,14 +59,21 @@ Settings.ldap['allow_username_or_email_login'] = false if Settings.ldap['allow_u
Settings
.
ldap
[
'sync_time'
]
=
3600
if
Settings
.
ldap
[
'sync_time'
].
nil?
# backwards compatibility, we only have one host
if
Settings
.
ldap
[
'enabled'
]
&&
Settings
.
ldap
[
'host'
].
present?
excluded_per_server_settings
=
%w(sync_time allow_username_or_email_login)
server
=
Settings
.
ldap
.
except
(
excluded_per_server_settings
)
server
[
'primary'
]
=
true
server
[
'label'
]
=
'LDAP'
Settings
.
ldap
[
'servers'
]
=
[
server
]
end
if
Settings
.
ldap
[
'enabled'
]
if
Settings
.
ldap
[
'host'
].
present?
excluded_per_server_settings
=
%w(sync_time allow_username_or_email_login)
server
=
Settings
.
ldap
.
except
(
excluded_per_server_settings
)
server
[
'primary'
]
=
true
server
[
'label'
]
=
'LDAP'
server
[
'provider_index'
]
=
''
#providername will be ldap
Settings
.
ldap
[
'servers'
]
=
[
server
]
end
Settings
.
ldap
[
'servers'
].
each
do
|
server
|
server
[
'provider_name'
]
=
"ldap
#{
server
[
'provider_id'
]
}
"
.
downcase
server
[
'provider_class'
]
=
OmniAuth
::
Utils
.
camelize
(
server
[
'provider_name'
])
end
end
Settings
[
'omniauth'
]
||=
Settingslogic
.
new
({})
Settings
.
omniauth
[
'enabled'
]
=
false
if
Settings
.
omniauth
[
'enabled'
].
nil?
Settings
.
omniauth
[
'providers'
]
||=
[]
...
...
config/initializers/7_omniauth.rb
View file @
d9355ea5
module
OmniAuth::Strategies
Gitlab
.
config
.
ldap
.
servers
.
each
do
|
server
|
class_name
=
"Ldap
#{
server
.
index
}
"
const_set
(
class_name
,
Class
.
new
(
LDAP
))
Gitlab
.
config
.
ldap
.
servers
.
each_with_index
do
|
server
|
const_set
(
server
.
provider_class
,
Class
.
new
(
LDAP
))
end
end
config/initializers/devise.rb
View file @
d9355ea5
...
...
@@ -212,7 +212,7 @@ Devise.setup do |config|
end
Gitlab
.
config
.
ldap
.
servers
.
each
do
|
server
|
config
.
omniauth
:"ldap
#{
server
.
index
}
"
,
config
.
omniauth
server
.
provider_name
,
host:
server
[
'host'
],
base:
server
[
'base'
],
uid:
server
[
'uid'
],
...
...
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