diff options
author | Douwe Maan <douwe@selenight.nl> | 2018-04-02 18:30:49 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-10 15:46:20 +0200 |
commit | 05732d90da0c556d6857bb4c1acd46d676dd07ba (patch) | |
tree | d26527f4ca748fc65b7e178e61cbd6631d591e51 | |
parent | 9d220da84117220317ccff1421a394185fefe859 (diff) | |
download | gitlab-ce-05732d90da0c556d6857bb4c1acd46d676dd07ba.tar.gz |
Rename delete_protected_branch ability to push_to_delete_protected_branch to prevent confusion with destroy_protected_branch
-rw-r--r-- | app/policies/project_policy.rb | 4 | ||||
-rw-r--r-- | app/views/projects/branches/_branch.html.haml | 2 | ||||
-rw-r--r-- | lib/gitlab/user_access.rb | 2 | ||||
-rw-r--r-- | spec/policies/project_policy_spec.rb | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 21bb0934dee..b495132d693 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -208,7 +208,7 @@ class ProjectPolicy < BasePolicy end rule { can?(:master_access) }.policy do - enable :delete_protected_branch + enable :push_to_delete_protected_branch enable :update_project_snippet enable :update_environment enable :update_deployment @@ -232,8 +232,8 @@ class ProjectPolicy < BasePolicy rule { archived }.policy do prevent :create_merge_request + prevent :push_to_delete_protected_branch prevent :push_code - prevent :delete_protected_branch prevent :update_merge_request prevent :admin_merge_request end diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml index 883dfb3e6c8..8bc146cbaf4 100644 --- a/app/views/projects/branches/_branch.html.haml +++ b/app/views/projects/branches/_branch.html.haml @@ -61,7 +61,7 @@ title: s_('Branches|The default branch cannot be deleted') } = icon("trash-o") - elsif protected_branch?(@project, branch) - - if can?(current_user, :delete_protected_branch, @project) + - if can?(current_user, :push_to_delete_protected_branch, @project) %button{ class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip", title: s_('Branches|Delete protected branch'), data: { toggle: "modal", diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb index 24393f96d96..69952cbb47c 100644 --- a/lib/gitlab/user_access.rb +++ b/lib/gitlab/user_access.rb @@ -51,7 +51,7 @@ module Gitlab return false unless can_access_git? if protected?(ProtectedBranch, project, ref) - user.can?(:delete_protected_branch, project) + user.can?(:push_to_delete_protected_branch, project) else user.can?(:push_code, project) end diff --git a/spec/policies/project_policy_spec.rb b/spec/policies/project_policy_spec.rb index 905d82b3bb1..7843af839df 100644 --- a/spec/policies/project_policy_spec.rb +++ b/spec/policies/project_policy_spec.rb @@ -43,7 +43,7 @@ describe ProjectPolicy do let(:base_master_permissions) do %i[ - delete_protected_branch update_project_snippet update_environment + push_to_delete_protected_branch update_project_snippet update_environment update_deployment admin_project_snippet admin_project_member admin_note admin_wiki admin_project admin_commit_status admin_build admin_container_image |