1 | |
---|
2 | ##################################################################### |
---|
3 | # This example demostrates how to use 'this' as a data term of a RT1 |
---|
4 | # policy credential where it is implicitly translated to a variable. |
---|
5 | # |
---|
6 | # Credential 1 is the policy credential with 2 intersecting rules. |
---|
7 | # A employee is up for a pay raise if the evaluator of the employee |
---|
8 | # affirms his/her good performance and the manager of the employee |
---|
9 | # affirms his/her pleasantness. |
---|
10 | # |
---|
11 | # Credential 2 is the policy credential that states an evaluator of |
---|
12 | # an employee is also the manager of the employee. |
---|
13 | # |
---|
14 | # Credential 3, 4 and 5 state Bob is the evaluator of Maryann and she |
---|
15 | # is showing good performance and is a nice coworker. Credential 6 and |
---|
16 | # 7 state Bob is also the evaluator of Joe and he is showing good |
---|
17 | # performance. But, there is no fact that says Joe is a nice coworker. |
---|
18 | # |
---|
19 | # The query.py file asks if a given principal is entitled to a pay |
---|
20 | # raise. Maryann is but not Joe, because his manager did not affirm |
---|
21 | # his pleasantness(but neither did he deny it) |
---|
22 | |
---|
23 | # Credential 1, |
---|
24 | # [keyid:alpha].role:payRaise <- |
---|
25 | # [keyid:alpha].role:evaluatorOf([principal:?this]).role:goodPerformance & |
---|
26 | # [keyid:alpha].role:managerOf([principal:?this]).role:niceCoworker |
---|
27 | |
---|
28 | # Credential 2 |
---|
29 | # [keyid:alpha].role:managerOf([principal:?Z])<- |
---|
30 | # [keyid:alpha].role:evaluatorOf([principal:?Z]) |
---|
31 | |
---|
32 | # Credential 3 |
---|
33 | # [keyid:alpha].role:evaluatorOf([keyid:Maryann]) <-[keyid:Bob] |
---|
34 | |
---|
35 | # Credential 4 |
---|
36 | # [keyid:Bob].role:goodPerformance <- [keyid:Maryann]) |
---|
37 | |
---|
38 | # Credential 5 |
---|
39 | # [keyid:Bob].role:niceCoworker <- [keyid:Maryann]) |
---|
40 | |
---|
41 | # Credential 6 |
---|
42 | # [keyid:alpha].role:evaluatorOf([keyid:Joe]) <-[keyid:Bob] |
---|
43 | |
---|
44 | # Credential 7 |
---|
45 | # [keyid:Bob].role:goodPerformance <- [keyid:Joe]) |
---|
46 | |
---|