summaryrefslogtreecommitdiff
path: root/doc/development/policies.md
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-18 12:06:03 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-18 12:06:03 +0000
commit16d9f66e9651d35b52e5a167789befe7b861292c (patch)
tree38ffe73aeffa5bc8ceaa3357db302edce6d874f6 /doc/development/policies.md
parent5333cb6c7c960aac58af40c898c87d050d829383 (diff)
downloadgitlab-ce-16d9f66e9651d35b52e5a167789befe7b861292c.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/policies.md')
-rw-r--r--doc/development/policies.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/development/policies.md b/doc/development/policies.md
index 833b0acb13e..8e5ef6e57c0 100644
--- a/doc/development/policies.md
+++ b/doc/development/policies.md
@@ -157,3 +157,18 @@ end
```
will include all rules from `ProjectPolicy`. The delegated conditions will be evaluated with the correct delegated subject, and will be sorted along with the regular rules in the policy. Note that only the relevant rules for a particular ability will actually be considered.
+
+## Specifying Policy Class
+
+You can also override the Policy used for a given subject:
+
+```ruby
+class Foo
+
+ def self.declarative_policy_class
+ 'SomeOtherPolicy'
+ end
+end
+```
+
+This will use & check permissions on the `SomeOtherPolicy` class rather than the usual calculated `FooPolicy` class.