Commit 83154f21 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Improve environment policy class

parent 88ace4a7
......@@ -4,12 +4,14 @@ class EnvironmentPolicy < BasePolicy
def rules
delegate! environment.project
if environment.stop_action?
delegate! environment.stop_action
if can?(:create_deployment) && environment.stop_action?
can! :stop_environment if can_play_stop_action?
end
end
if can?(:create_deployment) && can?(:play_build)
can! :stop_environment
end
private
def can_play_stop_action?
Ability.allowed?(user, :play_build, environment.stop_action)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment