diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-16 18:08:01 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-16 18:08:01 +0000 |
commit | 8e45d25f7dde6508839ffee719c0ddc2cf6b12d3 (patch) | |
tree | 9839e7fe63b36904d40995ebf519124c9a8f7681 /app/policies | |
parent | 00c78fb814d7ce00989ac04edd6cdaa3239da284 (diff) | |
download | gitlab-ce-8e45d25f7dde6508839ffee719c0ddc2cf6b12d3.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/deployment_policy.rb | 14 | ||||
-rw-r--r-- | app/policies/project_policy.rb | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/app/policies/deployment_policy.rb b/app/policies/deployment_policy.rb index d4f2f3c52b1..1a92b735e36 100644 --- a/app/policies/deployment_policy.rb +++ b/app/policies/deployment_policy.rb @@ -7,8 +7,20 @@ class DeploymentPolicy < BasePolicy can?(:update_build, @subject.deployable) end - rule { ~can_retry_deployable }.policy do + condition(:has_deployable) do + @subject.deployable.present? + end + + condition(:can_update_deployment) do + can?(:update_deployment, @subject.environment) + end + + rule { has_deployable & ~can_retry_deployable }.policy do prevent :create_deployment prevent :update_deployment end + + rule { ~can_update_deployment }.policy do + prevent :update_deployment + end end diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index a3540f31077..ea2be37d7e6 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -262,6 +262,7 @@ class ProjectPolicy < BasePolicy enable :destroy_container_image enable :create_environment enable :create_deployment + enable :update_deployment enable :create_release enable :update_release end |