summaryrefslogtreecommitdiff
path: root/app/policies
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-11-06 22:20:44 +0900
committerShinya Maeda <shinya@gitlab.com>2017-11-06 22:20:44 +0900
commit9b58b8e363fd388635385085c58be3d4637eaa45 (patch)
treee348f8d2cf9030d59448cea3dbc459a29bbecf95 /app/policies
parentd4ceec9d47a7da5fa17cb6e161ac491e13fcb8bd (diff)
downloadgitlab-ce-9b58b8e363fd388635385085c58be3d4637eaa45.tar.gz
Do not allow jobs to be erased
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/ci/build_policy.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/policies/ci/build_policy.rb b/app/policies/ci/build_policy.rb
index 984e5482288..f158cda2f0e 100644
--- a/app/policies/ci/build_policy.rb
+++ b/app/policies/ci/build_policy.rb
@@ -10,6 +10,11 @@ module Ci
end
end
+ condition(:owner_of_build) do
+ can?(:developer_access) && @subject.owned_by?(@user)
+ end
+
rule { protected_ref }.prevent :update_build
+ rule { can?(:master_access) | owner_of_build }.enable :erase_build
end
end