Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-18 15:06:03 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-18 15:06:03 +0300
commit16d9f66e9651d35b52e5a167789befe7b861292c (patch)
tree38ffe73aeffa5bc8ceaa3357db302edce6d874f6 /lib/declarative_policy.rb
parent5333cb6c7c960aac58af40c898c87d050d829383 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/declarative_policy.rb')
-rw-r--r--lib/declarative_policy.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/declarative_policy.rb b/lib/declarative_policy.rb
index d99a209dc87..9e9df88373a 100644
--- a/lib/declarative_policy.rb
+++ b/lib/declarative_policy.rb
@@ -74,7 +74,14 @@ module DeclarativePolicy
next unless klass.name
begin
- policy_class = "#{klass.name}Policy".constantize
+ klass_name =
+ if subject_class.respond_to?(:declarative_policy_class)
+ subject_class.declarative_policy_class
+ else
+ "#{klass.name}Policy"
+ end
+
+ policy_class = klass_name.constantize
# NOTE: the < operator here tests whether policy_class
# inherits from Base. We can't use #is_a? because that