From 8548a32c1be99d38460e0005a4fd5e652c1919f3 Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 17 Mar 2025 11:13:11 -0600 Subject: docs: extract a page to describe policy and FAQ --- doc/share/authz/POLICY.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 doc/share/authz/POLICY.md (limited to 'doc/share/authz/POLICY.md') diff --git a/doc/share/authz/POLICY.md b/doc/share/authz/POLICY.md new file mode 100644 index 00000000..30cca5fe --- /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 +``` -- cgit v1.2.3