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
6106cad9
Unverified
Commit
6106cad9
authored
Apr 13, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't reset application settings oauth providers by mistake
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
bcf7a7e7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
15 deletions
+31
-15
application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+7
-4
application_settings_helper.rb
app/helpers/application_settings_helper.rb
+3
-1
_signin.html.haml
app/views/admin/application_settings/_signin.html.haml
+1
-0
admin_settings_spec.rb
spec/features/admin/admin_settings_spec.rb
+20
-10
No files found.
app/controllers/admin/application_settings_controller.rb
View file @
6106cad9
...
...
@@ -58,11 +58,14 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
def
application_setting_params
params
[
:application_setting
]
||=
{}
enabled_oauth_sign_in_sources
=
params
[
:application_setting
].
delete
(
:enabled_oauth_sign_in_sources
)
if
params
[
:application_setting
].
key?
(
:enabled_oauth_sign_in_sources
)
enabled_oauth_sign_in_sources
=
params
[
:application_setting
].
delete
(
:enabled_oauth_sign_in_sources
)
enabled_oauth_sign_in_sources
&
.
delete
(
""
)
params
[
:application_setting
][
:disabled_oauth_sign_in_sources
]
=
AuthHelper
.
button_based_providers
.
map
(
&
:to_s
)
-
Array
(
enabled_oauth_sign_in_sources
)
params
[
:application_setting
][
:disabled_oauth_sign_in_sources
]
=
AuthHelper
.
button_based_providers
.
map
(
&
:to_s
)
-
Array
(
enabled_oauth_sign_in_sources
)
end
params
[
:application_setting
][
:import_sources
]
&
.
delete
(
""
)
params
[
:application_setting
][
:restricted_visibility_levels
]
&
.
delete
(
""
)
...
...
app/helpers/application_settings_helper.rb
View file @
6106cad9
...
...
@@ -74,10 +74,12 @@ module ApplicationSettingsHelper
css_class
=
'btn'
css_class
<<
' active'
unless
disabled
checkbox_name
=
'application_setting[enabled_oauth_sign_in_sources][]'
name
=
Gitlab
::
Auth
::
OAuth
::
Provider
.
label_for
(
source
)
label_tag
(
checkbox_name
,
class:
css_class
)
do
check_box_tag
(
checkbox_name
,
source
,
!
disabled
,
autocomplete:
'off'
)
+
Gitlab
::
Auth
::
OAuth
::
Provider
.
label_for
(
source
)
autocomplete:
'off'
,
id:
name
.
tr
(
' '
,
'_'
))
+
name
end
end
end
...
...
app/views/admin/application_settings/_signin.html.haml
View file @
6106cad9
...
...
@@ -24,6 +24,7 @@
-
if
omniauth_enabled?
&&
button_based_providers
.
any?
.form-group
=
f
.
label
:enabled_oauth_sign_in_sources
,
'Enabled OAuth sign-in sources'
,
class:
'control-label col-sm-2'
=
hidden_field_tag
'application_setting[enabled_oauth_sign_in_sources][]'
.col-sm-10
.btn-group
{
data:
{
toggle:
'buttons'
}
}
-
oauth_providers_checkboxes
.
each
do
|
source
|
...
...
spec/features/admin/admin_settings_spec.rb
View file @
6106cad9
...
...
@@ -85,6 +85,26 @@ feature 'Admin updates settings' do
expect
(
page
).
to
have_content
"Application settings saved successfully"
end
scenario
'Modify oauth providers'
do
expect
(
Gitlab
::
CurrentSettings
.
disabled_oauth_sign_in_sources
).
to
be_empty
page
.
within
(
'.as-signin'
)
do
uncheck
'Google'
click_button
'Save changes'
end
expect
(
page
).
to
have_content
"Application settings saved successfully"
expect
(
Gitlab
::
CurrentSettings
.
disabled_oauth_sign_in_sources
).
to
include
(
'google_oauth2'
)
page
.
within
(
'.as-signin'
)
do
check
"Google"
click_button
'Save changes'
end
expect
(
page
).
to
have_content
"Application settings saved successfully"
expect
(
Gitlab
::
CurrentSettings
.
disabled_oauth_sign_in_sources
).
not_to
include
(
'google_oauth2'
)
end
scenario
'Change Help page'
do
page
.
within
(
'.as-help-page'
)
do
fill_in
'Help page text'
,
with:
'Example text'
...
...
@@ -234,16 +254,6 @@ feature 'Admin updates settings' do
expect
(
find
(
'#service_push_channel'
).
value
).
to
eq
'#test_channel'
end
context
'sign-in restrictions'
,
:js
do
it
'de-activates oauth sign-in source'
do
page
.
within
(
'.as-signin'
)
do
find
(
'input#application_setting_enabled_oauth_sign_in_sources_[value=gitlab]'
).
send_keys
(
:return
)
expect
(
find
(
'.btn'
,
text:
'GitLab.com'
)).
not_to
have_css
(
'.active'
)
end
end
end
scenario
'Change Keys settings'
do
page
.
within
(
'.as-visibility-access'
)
do
select
'Are forbidden'
,
from:
'RSA SSH keys'
...
...
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