summaryrefslogtreecommitdiff
path: root/app/policies/ci
diff options
context:
space:
mode:
authorMark Fletcher <mark@gitlab.com>2017-07-20 17:54:36 +0700
committerMark Fletcher <mark@gitlab.com>2018-02-01 17:25:13 +0000
commit391d1915c8a9e6f723594a6f4930dcd90fe1bc1a (patch)
tree62b59142e4275d527f35e44cae73154823b4a24f /app/policies/ci
parent5b73e0eb35f5b9b78c228a4867ef78538ef05653 (diff)
downloadgitlab-ce-391d1915c8a9e6f723594a6f4930dcd90fe1bc1a.tar.gz
Hide pipeline schedule 'take ownership' for current owner
Diffstat (limited to 'app/policies/ci')
-rw-r--r--app/policies/ci/pipeline_schedule_policy.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/policies/ci/pipeline_schedule_policy.rb b/app/policies/ci/pipeline_schedule_policy.rb
index abcf536b2f7..dc7a4aed577 100644
--- a/app/policies/ci/pipeline_schedule_policy.rb
+++ b/app/policies/ci/pipeline_schedule_policy.rb
@@ -10,6 +10,10 @@ module Ci
can?(:developer_access) && pipeline_schedule.owned_by?(@user)
end
+ condition(:non_owner_of_schedule) do
+ !pipeline_schedule.owned_by?(@user)
+ end
+
rule { can?(:developer_access) }.policy do
enable :play_pipeline_schedule
end
@@ -19,6 +23,10 @@ module Ci
enable :admin_pipeline_schedule
end
+ rule { can?(:master_access) & non_owner_of_schedule }.policy do
+ enable :take_ownership_pipeline_schedule
+ end
+
rule { protected_ref }.prevent :play_pipeline_schedule
end
end