Enabled no-one as a merge access level in protected branches
Closes #31541
This commit is contained in:
parent
566ee14516
commit
025a1b0175
5 changed files with 23 additions and 29 deletions
|
@ -7,5 +7,23 @@ module ProtectedBranchAccess
|
|||
belongs_to :protected_branch
|
||||
|
||||
delegate :project, to: :protected_branch
|
||||
|
||||
validates :access_level, presence: true, inclusion: { in: [Gitlab::Access::MASTER,
|
||||
Gitlab::Access::DEVELOPER,
|
||||
Gitlab::Access::NO_ACCESS] }
|
||||
|
||||
def self.human_access_levels
|
||||
{
|
||||
Gitlab::Access::MASTER => "Masters",
|
||||
Gitlab::Access::DEVELOPER => "Developers + Masters",
|
||||
Gitlab::Access::NO_ACCESS => "No one"
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
def check_access(user)
|
||||
return false if access_level == Gitlab::Access::NO_ACCESS
|
||||
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,13 +1,3 @@
|
|||
class ProtectedBranch::MergeAccessLevel < ActiveRecord::Base
|
||||
include ProtectedBranchAccess
|
||||
|
||||
validates :access_level, presence: true, inclusion: { in: [Gitlab::Access::MASTER,
|
||||
Gitlab::Access::DEVELOPER] }
|
||||
|
||||
def self.human_access_levels
|
||||
{
|
||||
Gitlab::Access::MASTER => "Masters",
|
||||
Gitlab::Access::DEVELOPER => "Developers + Masters"
|
||||
}.with_indifferent_access
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
class ProtectedBranch::PushAccessLevel < ActiveRecord::Base
|
||||
include ProtectedBranchAccess
|
||||
|
||||
validates :access_level, presence: true, inclusion: { in: [Gitlab::Access::MASTER,
|
||||
Gitlab::Access::DEVELOPER,
|
||||
Gitlab::Access::NO_ACCESS] }
|
||||
|
||||
def self.human_access_levels
|
||||
{
|
||||
Gitlab::Access::MASTER => "Masters",
|
||||
Gitlab::Access::DEVELOPER => "Developers + Masters",
|
||||
Gitlab::Access::NO_ACCESS => "No one"
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
def check_access(user)
|
||||
return false if access_level == Gitlab::Access::NO_ACCESS
|
||||
|
||||
super
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Allow 'no one' as an option for allowed to merge on a procted branch
|
||||
merge_request:
|
||||
author:
|
|
@ -31,7 +31,7 @@ RSpec.shared_examples "protected branches > access control > CE" do
|
|||
|
||||
within(".protected-branches-list") do
|
||||
find(".js-allowed-to-push").click
|
||||
|
||||
|
||||
within('.js-allowed-to-push-container') do
|
||||
expect(first("li")).to have_content("Roles")
|
||||
click_on access_type_name
|
||||
|
|
Loading…
Reference in a new issue