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
Show 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
...
@@ -33,7 +33,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
end
end
Gitlab
.
config
.
ldap
.
servers
.
each
do
|
server
|
Gitlab
.
config
.
ldap
.
servers
.
each
do
|
server
|
alias_method
"ldap
#{
server
.
index
}
"
,
:ldap
alias_method
server
.
provider_name
,
:ldap
end
end
def
omniauth_error
def
omniauth_error
...
...
app/views/devise/sessions/new.html.haml
View file @
d9355ea5
...
@@ -6,13 +6,13 @@
...
@@ -6,13 +6,13 @@
%ul
.nav.nav-tabs
%ul
.nav.nav-tabs
-
@ldap_servers
.
each
do
|
server
|
-
@ldap_servers
.
each
do
|
server
|
%li
{
class:
(
:active
if
server
[
'primary'
])}
%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
%li
=
link_to
'Standard'
,
'#tab-signin'
,
'data-toggle'
=>
'tab'
=
link_to
'Standard'
,
'#tab-signin'
,
'data-toggle'
=>
'tab'
.tab-content
.tab-content
-
@ldap_servers
.
each
do
|
server
|
-
@ldap_servers
.
each
do
|
server
|
%div
.tab-pane
{
id:
"tab-
ldap#{server.index
}"
,
class:
(
:active
if
server
[
'primary'
])}
%div
.tab-pane
{
id:
"tab-
#{server.provider_name
}"
,
class:
(
:active
if
server
[
'primary'
])}
=
render
'devise/sessions/new_ldap'
,
provider:
"ldap
#{
server
.
index
}
"
=
render
'devise/sessions/new_ldap'
,
provider:
server
.
provider_name
%div
#tab-signin
.tab-pane
%div
#tab-signin
.tab-pane
=
render
'devise/sessions/new_base'
=
render
'devise/sessions/new_base'
...
...
config/initializers/1_settings.rb
View file @
d9355ea5
...
@@ -52,7 +52,6 @@ class Settings < Settingslogic
...
@@ -52,7 +52,6 @@ class Settings < Settingslogic
end
end
end
end
# Default settings
# Default settings
Settings
[
'ldap'
]
||=
Settingslogic
.
new
({})
Settings
[
'ldap'
]
||=
Settingslogic
.
new
({})
Settings
.
ldap
[
'enabled'
]
=
false
if
Settings
.
ldap
[
'enabled'
].
nil?
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
...
@@ -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?
Settings
.
ldap
[
'sync_time'
]
=
3600
if
Settings
.
ldap
[
'sync_time'
].
nil?
# backwards compatibility, we only have one host
# backwards compatibility, we only have one host
if
Settings
.
ldap
[
'enabled'
]
&&
Settings
.
ldap
[
'host'
].
present?
if
Settings
.
ldap
[
'enabled'
]
if
Settings
.
ldap
[
'host'
].
present?
excluded_per_server_settings
=
%w(sync_time allow_username_or_email_login)
excluded_per_server_settings
=
%w(sync_time allow_username_or_email_login)
server
=
Settings
.
ldap
.
except
(
excluded_per_server_settings
)
server
=
Settings
.
ldap
.
except
(
excluded_per_server_settings
)
server
[
'primary'
]
=
true
server
[
'primary'
]
=
true
server
[
'label'
]
=
'LDAP'
server
[
'label'
]
=
'LDAP'
server
[
'provider_index'
]
=
''
#providername will be ldap
Settings
.
ldap
[
'servers'
]
=
[
server
]
Settings
.
ldap
[
'servers'
]
=
[
server
]
end
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'
]
||=
Settingslogic
.
new
({})
Settings
.
omniauth
[
'enabled'
]
=
false
if
Settings
.
omniauth
[
'enabled'
].
nil?
Settings
.
omniauth
[
'enabled'
]
=
false
if
Settings
.
omniauth
[
'enabled'
].
nil?
Settings
.
omniauth
[
'providers'
]
||=
[]
Settings
.
omniauth
[
'providers'
]
||=
[]
...
...
config/initializers/7_omniauth.rb
View file @
d9355ea5
module
OmniAuth::Strategies
module
OmniAuth::Strategies
Gitlab
.
config
.
ldap
.
servers
.
each
do
|
server
|
Gitlab
.
config
.
ldap
.
servers
.
each_with_index
do
|
server
|
class_name
=
"Ldap
#{
server
.
index
}
"
const_set
(
server
.
provider_class
,
Class
.
new
(
LDAP
))
const_set
(
class_name
,
Class
.
new
(
LDAP
))
end
end
end
end
config/initializers/devise.rb
View file @
d9355ea5
...
@@ -212,7 +212,7 @@ Devise.setup do |config|
...
@@ -212,7 +212,7 @@ Devise.setup do |config|
end
end
Gitlab
.
config
.
ldap
.
servers
.
each
do
|
server
|
Gitlab
.
config
.
ldap
.
servers
.
each
do
|
server
|
config
.
omniauth
:"ldap
#{
server
.
index
}
"
,
config
.
omniauth
server
.
provider_name
,
host:
server
[
'host'
],
host:
server
[
'host'
],
base:
server
[
'base'
],
base:
server
[
'base'
],
uid:
server
[
'uid'
],
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