diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2018-07-10 08:11:04 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-07-10 08:11:04 +0000 |
commit | d79cef3a9a5577765d975326fbf4bc1b8c5634de (patch) | |
tree | fad8dce6f89102fda75f511dee80b7fae7675994 /app/policies | |
parent | ca1deb9e5ec1429a65d73b3352d1207301f9fc6f (diff) | |
download | gitlab-ce-d79cef3a9a5577765d975326fbf4bc1b8c5634de.tar.gz |
Support manually stopping any environment from the UI
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/environment_policy.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/policies/environment_policy.rb b/app/policies/environment_policy.rb index 375a5535359..978dc3a7c81 100644 --- a/app/policies/environment_policy.rb +++ b/app/policies/environment_policy.rb @@ -1,9 +1,13 @@ class EnvironmentPolicy < BasePolicy delegate { @subject.project } - condition(:stop_action_allowed) do - @subject.stop_action? && can?(:update_build, @subject.stop_action) + condition(:stop_with_deployment_allowed) do + @subject.stop_action? && can?(:create_deployment) && can?(:update_build, @subject.stop_action) end - rule { can?(:create_deployment) & stop_action_allowed }.enable :stop_environment + condition(:stop_with_update_allowed) do + !@subject.stop_action? && can?(:update_environment, @subject) + end + + rule { stop_with_deployment_allowed | stop_with_update_allowed }.enable :stop_environment end |