BigW Consortium Gitlab

Commit 83154f21 by Grzegorz Bizon

Improve environment policy class

parent 88ace4a7
...@@ -4,12 +4,14 @@ class EnvironmentPolicy < BasePolicy ...@@ -4,12 +4,14 @@ class EnvironmentPolicy < BasePolicy
def rules def rules
delegate! environment.project delegate! environment.project
if environment.stop_action? if can?(:create_deployment) && environment.stop_action?
delegate! environment.stop_action can! :stop_environment if can_play_stop_action?
end end
end
if can?(:create_deployment) && can?(:play_build) private
can! :stop_environment
end def can_play_stop_action?
Ability.allowed?(user, :play_build, environment.stop_action)
end end
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