summaryrefslogtreecommitdiff
path: root/app/policies/environment_policy.rb
blob: 0b976e5664d0478efee98b2f3b9e540a49083a89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class EnvironmentPolicy < BasePolicy

  alias_method :environment, :subject

  def rules
    delegate! environment.project

    if environment.stop_action?
      delegate! environment.stop_action
    end

    if can?(:create_deployment) && can?(:play_build)
      can! :stop_environment
    end
  end
end