diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-06-17 13:00:34 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-06-17 13:00:34 +0000 |
commit | e08d13420d3d48524c9b922e2307bfd1d8c765f6 (patch) | |
tree | 160c7013f8437ca25f8b766fa915e262e9312457 /app/policies | |
parent | d87d965e7ffdbb0abc1eea4f0aadd4d0f50f1433 (diff) | |
parent | 42d6d3187fb7305daead326bfdf56a09c249f829 (diff) | |
download | gitlab-ce-e08d13420d3d48524c9b922e2307bfd1d8c765f6.tar.gz |
Merge branch 'error-pipelines-for-blocked-users' into 'master'
Preventing blocked users and their PipelineSchdules from creating new Pipelines
Closes #47756
See merge request gitlab-org/gitlab-ce!27318
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/base_policy.rb | 4 | ||||
-rw-r--r-- | app/policies/global_policy.rb | 4 | ||||
-rw-r--r-- | app/policies/project_policy.rb | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/app/policies/base_policy.rb b/app/policies/base_policy.rb index 5dd2279ef99..82bf9bf8bf6 100644 --- a/app/policies/base_policy.rb +++ b/app/policies/base_policy.rb @@ -7,6 +7,10 @@ class BasePolicy < DeclarativePolicy::Base with_options scope: :user, score: 0 condition(:admin) { @user&.admin? } + desc "User is blocked" + with_options scope: :user, score: 0 + condition(:blocked) { @user&.blocked? } + desc "User has access to all private groups & projects" with_options scope: :user, score: 0 condition(:full_private_access) { @user&.full_private_access? } diff --git a/app/policies/global_policy.rb b/app/policies/global_policy.rb index e85397422e6..134de1c9ace 100644 --- a/app/policies/global_policy.rb +++ b/app/policies/global_policy.rb @@ -1,10 +1,6 @@ # frozen_string_literal: true class GlobalPolicy < BasePolicy - desc "User is blocked" - with_options scope: :user, score: 0 - condition(:blocked) { @user&.blocked? } - desc "User is an internal user" with_options scope: :user, score: 0 condition(:internal) { @user&.internal? } diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index a3632640ede..b3e29e775fc 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -447,6 +447,10 @@ class ProjectPolicy < BasePolicy prevent :owner_access end + rule { blocked }.policy do + prevent :create_pipeline + end + private def team_member? |