##################################################################### # This example demostrates how to use 'this' as a data term of a RT1 # policy credential where it is implicitly translated to a variable. # # Credential 1 is the policy credential with 2 intersecting rules. # A employee is up for a pay raise if the evaluator of the employee # affirms his/her good performance and the manager of the employee # affirms his/her pleasantness. # # Credential 2 is the policy credential that states an evaluator of # an employee is also the manager of the employee. # # Credential 3, 4 and 5 state Bob is the evaluator of Maryann and she # is showing good performance and is a nice coworker. Credential 6 and # 7 state Bob is also the evaluator of Joe and he is showing good # performance. But, there is no fact that says Joe is a nice coworker. # # The query.py file asks if a given principal is entitled to a pay # raise. Maryann is but not Joe, because his manager did not affirm # his pleasantness(but neither did he deny it) # Credential 1, # [keyid:alpha].role:payRaise <- # [keyid:alpha].role:evaluatorOf([principal:?this]).role:goodPerformance & # [keyid:alpha].role:managerOf([principal:?this]).role:niceCoworker # Credential 2 # [keyid:alpha].role:managerOf([principal:?Z])<- # [keyid:alpha].role:evaluatorOf([principal:?Z]) # Credential 3 # [keyid:alpha].role:evaluatorOf([keyid:Maryann]) <-[keyid:Bob] # Credential 4 # [keyid:Bob].role:goodPerformance <- [keyid:Maryann]) # Credential 5 # [keyid:Bob].role:niceCoworker <- [keyid:Maryann]) # Credential 6 # [keyid:alpha].role:evaluatorOf([keyid:Joe]) <-[keyid:Bob] # Credential 7 # [keyid:Bob].role:goodPerformance <- [keyid:Joe])