Commit fbaabb39 authored by Patricio Cano's avatar Patricio Cano

Rename `enabled_git_access_protocols` to singular.

parent 120a1189
......@@ -23,6 +23,8 @@ v 8.10.0 (unreleased)
- Add notification settings dropdown for groups
- Allow importing from Github using Personal Access Tokens. (Eric K Idema)
- API: Todos !3188 (Robert Schilling)
- Add "Enabled Git access protocols" to Application Settings
- Implement Subresource Integrity for CSS and JavaScript assets. This prevents malicious assets from loading in the case of a CDN compromise.
- Fix user creation with stronger minimum password requirements !4054 (nathan-pmt)
- PipelinesFinder uses git cache data
- Check for conflicts with existing Project's wiki path when creating a new project.
......@@ -176,7 +178,6 @@ v 8.9.0
- Fix horizontal scrollbar for long commit message.
- GitLab Performance Monitoring now tracks the total method execution time and call count per method
- Add Environments and Deployments
- Add "Enabled Git access protocols" to Application Settings
- Redesign account and email confirmation emails
- Don't fail builds for projects that are deleted
- Support Docker Registry manifest v1
......
......@@ -32,11 +32,11 @@ module ApplicationSettingsHelper
end
def allowed_protocols_present?
current_application_settings.enabled_git_access_protocols.present?
current_application_settings.enabled_git_access_protocol.present?
end
def enabled_protocol
case current_application_settings.enabled_git_access_protocols
case current_application_settings.enabled_git_access_protocol
when 'http'
gitlab_config.protocol
when 'ssh'
......
......@@ -59,7 +59,7 @@ class ApplicationSetting < ActiveRecord::Base
presence: true,
inclusion: { in: ->(_object) { Gitlab.config.repositories.storages.keys } }
validates :enabled_git_access_protocols,
validates :enabled_git_access_protocol,
inclusion: { in: %w(ssh http), allow_blank: true, allow_nil: true }
validates_each :restricted_visibility_levels do |record, attr, value|
......
......@@ -46,7 +46,7 @@
.form-group
%label.control-label.col-sm-2 Enabled Git access protocols
.col-sm-10
= select(:application_setting, :enabled_git_access_protocols, [['Both SSH and HTTP(S)', nil], ['Only SSH', 'ssh'], ['Only HTTP(S)', 'http']], {}, class: 'form-control')
= select(:application_setting, :enabled_git_access_protocol, [['Both SSH and HTTP(S)', nil], ['Only SSH', 'ssh'], ['Only HTTP(S)', 'http']], {}, class: 'form-control')
%span.help-block#clone-protocol-help
Allow only the selected protocols to be used for Git access.
.form-group
......
......@@ -6,6 +6,6 @@ class AddEnabledGitAccessProtocolsToApplicationSettings < ActiveRecord::Migratio
include Gitlab::Database::MigrationHelpers
def change
add_column :application_settings, :enabled_git_access_protocols, :string
add_column :application_settings, :enabled_git_access_protocol, :string
end
end
......@@ -3,10 +3,10 @@ module Gitlab
def self.allowed?(protocol)
if protocol.to_s == 'web'
true
elsif current_application_settings.enabled_git_access_protocols.blank?
elsif current_application_settings.enabled_git_access_protocol.blank?
true
else
protocol.to_s == current_application_settings.enabled_git_access_protocols
protocol.to_s == current_application_settings.enabled_git_access_protocol
end
end
end
......
......@@ -54,13 +54,13 @@ feature 'Admin disables Git access protocol', feature: true do
def disable_http_protocol
visit admin_application_settings_path
find('#application_setting_enabled_git_access_protocols').find(:xpath, 'option[2]').select_option
find('#application_setting_enabled_git_access_protocol').find(:xpath, 'option[2]').select_option
click_on 'Save'
end
def disable_ssh_protocol
visit admin_application_settings_path
find('#application_setting_enabled_git_access_protocols').find(:xpath, 'option[3]').select_option
find('#application_setting_enabled_git_access_protocol').find(:xpath, 'option[3]').select_option
click_on 'Save'
end
end
......@@ -70,7 +70,7 @@ describe Gitlab::GitAccess, lib: true do
describe '#check with single protocols allowed' do
def disable_protocol(protocol)
settings = ::ApplicationSetting.create_from_defaults
settings.update_attribute(:enabled_git_access_protocols, protocol)
settings.update_attribute(:enabled_git_access_protocol, protocol)
end
context 'ssh disabled' do
......
......@@ -211,7 +211,7 @@ describe API::API, api: true do
context 'ssh access has been disabled' do
before do
settings = ::ApplicationSetting.create_from_defaults
settings.update_attribute(:enabled_git_access_protocols, 'http')
settings.update_attribute(:enabled_git_access_protocol, 'http')
end
it 'rejects the SSH push' do
......@@ -234,7 +234,7 @@ describe API::API, api: true do
context 'http access has been disabled' do
before do
settings = ::ApplicationSetting.create_from_defaults
settings.update_attribute(:enabled_git_access_protocols, 'ssh')
settings.update_attribute(:enabled_git_access_protocol, 'ssh')
end
it 'rejects the HTTP push' do
......@@ -257,7 +257,7 @@ describe API::API, api: true do
context 'web actions are always allowed' do
it 'allows WEB push' do
settings = ::ApplicationSetting.create_from_defaults
settings.update_attribute(:enabled_git_access_protocols, 'ssh')
settings.update_attribute(:enabled_git_access_protocol, 'ssh')
project.team << [user, :developer]
push(key, project, 'web')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment