diff options
Diffstat (limited to 'app/policies/environment_policy.rb')
-rw-r--r-- | app/policies/environment_policy.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/policies/environment_policy.rb b/app/policies/environment_policy.rb index f4219569161..0b976e5664d 100644 --- a/app/policies/environment_policy.rb +++ b/app/policies/environment_policy.rb @@ -1,5 +1,16 @@ class EnvironmentPolicy < BasePolicy + + alias_method :environment, :subject + def rules - delegate! @subject.project + 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 |