summaryrefslogtreecommitdiff
path: root/app/models/ci/pipeline_schedule.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ci/pipeline_schedule.rb')
-rw-r--r--app/models/ci/pipeline_schedule.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/ci/pipeline_schedule.rb b/app/models/ci/pipeline_schedule.rb
index 6d7cc83971e..cf6e53c4ca4 100644
--- a/app/models/ci/pipeline_schedule.rb
+++ b/app/models/ci/pipeline_schedule.rb
@@ -28,10 +28,18 @@ module Ci
!active?
end
+ def deactivate!
+ update_attribute(:active, false)
+ end
+
def importing_or_inactive?
importing? || inactive?
end
+ def runnable_by_owner?
+ Ability.allowed?(owner, :create_pipeline, project)
+ end
+
def set_next_run_at
self.next_run_at = Gitlab::Ci::CronParser.new(cron, cron_timezone).next_time_from(Time.now)
end