diff options
author | Luke Bennett <lbennett@gitlab.com> | 2018-09-24 14:39:00 +0100 |
---|---|---|
committer | Luke Bennett <lbennett@gitlab.com> | 2018-09-24 14:39:00 +0100 |
commit | 05afd11e16aecd43adfb869ae90aa6cae13916ec (patch) | |
tree | 63b31431981d48ac970853778dd01a5301bb9564 /app/policies | |
parent | 086549d986a453e1b2dd0d09ffbd19d0487d9c51 (diff) | |
parent | 28086b203ae397e01d5e9870dfbddd66466450c2 (diff) | |
download | gitlab-ce-05afd11e16aecd43adfb869ae90aa6cae13916ec.tar.gz |
Merge remote-tracking branch 'origin/master' into ce-6983-promote-starting-a-gitlab-com-trial
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/application_setting/term_policy.rb | 2 | ||||
-rw-r--r-- | app/policies/ci/runner_policy.rb | 2 | ||||
-rw-r--r-- | app/policies/deploy_key_policy.rb | 2 | ||||
-rw-r--r-- | app/policies/project_policy.rb | 2 |
4 files changed, 8 insertions, 0 deletions
diff --git a/app/policies/application_setting/term_policy.rb b/app/policies/application_setting/term_policy.rb index 17f00f33d35..c0d2ceaa349 100644 --- a/app/policies/application_setting/term_policy.rb +++ b/app/policies/application_setting/term_policy.rb @@ -19,6 +19,7 @@ class ApplicationSetting rule { terms_accepted }.prevent :accept_terms + # rubocop: disable CodeReuse/ActiveRecord def agreement strong_memoize(:agreement) do next nil if @user.nil? || @subject.nil? @@ -26,5 +27,6 @@ class ApplicationSetting @user.term_agreements.find_by(term: @subject) end end + # rubocop: enable CodeReuse/ActiveRecord end end diff --git a/app/policies/ci/runner_policy.rb b/app/policies/ci/runner_policy.rb index c44f22b6ad3..de76b7b2b5b 100644 --- a/app/policies/ci/runner_policy.rb +++ b/app/policies/ci/runner_policy.rb @@ -5,7 +5,9 @@ module Ci with_options scope: :subject, score: 0 condition(:locked, scope: :subject) { @subject.locked? } + # rubocop: disable CodeReuse/ActiveRecord condition(:owned_runner) { @user.ci_owned_runners.exists?(@subject.id) } + # rubocop: enable CodeReuse/ActiveRecord rule { anonymous }.prevent_all diff --git a/app/policies/deploy_key_policy.rb b/app/policies/deploy_key_policy.rb index 204c54a5b20..7f0ec011e79 100644 --- a/app/policies/deploy_key_policy.rb +++ b/app/policies/deploy_key_policy.rb @@ -4,7 +4,9 @@ class DeployKeyPolicy < BasePolicy with_options scope: :subject, score: 0 condition(:private_deploy_key) { @subject.private? } + # rubocop: disable CodeReuse/ActiveRecord condition(:has_deploy_key) { @user.project_deploy_keys.exists?(id: @subject.id) } + # rubocop: enable CodeReuse/ActiveRecord rule { anonymous }.prevent_all diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 273a93a1423..d0e84b1aa38 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -398,6 +398,7 @@ class ProjectPolicy < BasePolicy end end + # rubocop: disable CodeReuse/ActiveRecord def project_group_member? return false if @user.nil? @@ -407,6 +408,7 @@ class ProjectPolicy < BasePolicy project.group.requesters.exists?(user_id: @user.id) ) end + # rubocop: enable CodeReuse/ActiveRecord def team_access_level return -1 if @user.nil? |