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