summaryrefslogtreecommitdiff
path: root/app/policies/ci/pipeline_schedule_policy.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/policies/ci/pipeline_schedule_policy.rb')
-rw-r--r--app/policies/ci/pipeline_schedule_policy.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/policies/ci/pipeline_schedule_policy.rb b/app/policies/ci/pipeline_schedule_policy.rb
new file mode 100644
index 00000000000..6b7598e1821
--- /dev/null
+++ b/app/policies/ci/pipeline_schedule_policy.rb
@@ -0,0 +1,14 @@
+module Ci
+ class PipelineSchedulePolicy < PipelinePolicy
+ alias_method :pipeline_schedule, :subject
+
+ condition(:owner_of_schedule) do
+ can?(:developer_access) && pipeline_schedule.owned_by?(@user)
+ end
+
+ rule { can?(:master_access) | owner_of_schedule }.policy do
+ enable :update_pipeline_schedule
+ enable :admin_pipeline_schedule
+ end
+ end
+end