blob: 30cca5fee6812b925af0fab52fdba407ffd8df3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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
```
|