summaryrefslogtreecommitdiff
path: root/doc/share/authz/POLICY.md
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-03-17 11:13:11 -0600
committermo khan <mo@mokhan.ca>2025-03-17 11:13:11 -0600
commit8548a32c1be99d38460e0005a4fd5e652c1919f3 (patch)
tree9cda39ef0aa977c0ab7797326dfbb4c626ade533 /doc/share/authz/POLICY.md
parente6e7a914bea59c3bcf917269e333b2adbaa96f60 (diff)
docs: extract a page to describe policy and FAQ
Diffstat (limited to 'doc/share/authz/POLICY.md')
-rw-r--r--doc/share/authz/POLICY.md51
1 files changed, 51 insertions, 0 deletions
diff --git a/doc/share/authz/POLICY.md b/doc/share/authz/POLICY.md
new file mode 100644
index 0000000..30cca5f
--- /dev/null
+++ b/doc/share/authz/POLICY.md
@@ -0,0 +1,51 @@
+# Policy
+
+A policy is a predicate that describes if a subject can perform an action
+against a specific resource.
+
+```ruby
+ policy(:parent) { predicate }
+ policy(:partner) { predicate }
+ policy(:sibling) { predicate }
+ policy(:child) { predicate }
+
+ enable(:permission, on: resource).when { parent | partner }
+```
+
+Authorizaion uses policies to determine if a subject in a specific context is
+authorized to perform an action against a resource.
+
+```ruby
+ def can?(subject, action, resource)
+ end
+```
+
+## Policy Language
+
+A policy language facilitates:
+
+1. the specification of composite policies, which in turn forms the basis of trust delegation.
+1. **the static analysis of policies and system configuration.**
+
+## Example
+
+The following hierarchy will be used as the basis for expression policy.
+
+```ruby
+class Organization
+ has_many :groups
+end
+
+class Group
+ belongs_to :organization
+ has_many :projects
+end
+
+class Project
+ belongs_to :group
+ has_many :issues
+end
+
+class Issue
+end
+```