gitlab-org--gitlab-foss/app/policies/environment_policy.rb
Grzegorz Bizon e270366d84 Rename environments stop action method
This makes it more explicit that an environment is not a stop action,
but instead is merely contains a stop action.
2018-07-12 12:22:11 +02:00

14 lines
459 B
Ruby

class EnvironmentPolicy < BasePolicy
delegate { @subject.project }
condition(:stop_with_deployment_allowed) do
@subject.stop_action_available? &&
can?(:create_deployment) && can?(:update_build, @subject.stop_action)
end
condition(:stop_with_update_allowed) do
!@subject.stop_action_available? && can?(:update_environment, @subject)
end
rule { stop_with_deployment_allowed | stop_with_update_allowed }.enable :stop_environment
end