Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-11-06 20:47:05 +0300
committerShinya Maeda <shinya@gitlab.com>2017-11-06 20:47:05 +0300
commitafef38533727cf32a7be324243a25b4db5eb5498 (patch)
treecfdd2c96bd0c1a7ee1fd85f0b63fd2edf0d1fe3f /app/policies
parentcb5e35d562a1bf0737c1ad3316c3723775fada01 (diff)
Add doc. Fix spec. Add erase_build in protected_ref rule
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/ci/build_policy.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/policies/ci/build_policy.rb b/app/policies/ci/build_policy.rb
index f158cda2f0e..1ab391a5a9d 100644
--- a/app/policies/ci/build_policy.rb
+++ b/app/policies/ci/build_policy.rb
@@ -10,11 +10,15 @@ module Ci
end
end
- condition(:owner_of_build) do
- can?(:developer_access) && @subject.owned_by?(@user)
+ condition(:owner_of_job) do
+ can?(:developer_access) && @subject.triggered_by?(@user)
end
- rule { protected_ref }.prevent :update_build
- rule { can?(:master_access) | owner_of_build }.enable :erase_build
+ rule { protected_ref }.policy do
+ prevent :update_build
+ prevent :erase_build
+ end
+
+ rule { can?(:master_access) | owner_of_job }.enable :erase_build
end
end