Obligations and Advice

Obligations and advice appears as expressions in rules, policies or policy sets. Here is a rule with some obligations and advice.

rule {
    deny
    condition not(booleanOneAndOnly(Attributes.careRelationExists))
    on permit {
         obligation ObligationAdvice.notifyPatient {
              Attributes.message = "Your record was accessed"
              Attributes.notificationRecipient = Attributes.patientId
         }
         obligation ObligationAdvice.logAccess
    }
    on deny {
        advice ObligationAdvice.reasonForDeny {
            Attributes.message = "There is no care relation"
        }
    }
}

Advice and obligations apply either to Deny or Permit decisions. This is indicated by "on deny" and "on permit" respectively. An obligation is defined with the "obligation" keyword and an advice is defined with the "advice" keyword. The keyword is followed with the name of the obligation or advice. The name has to have been declared somewhere. See the section on obligation and advice declarations for details.

An obligation or advice may optionally contain attribute assignments. In the example above, the logAccess obligation does not contain an attribute assignment, while the other examples do. An attribute assignment consists of an attribute that is assigned a value from an expression. The attribute assignment can in this manner be used to provide parameters to the obligation. In the above example, the reasonForDeny advice contains a message explaining the reason for the denied access. If access had been permitted, a notification would be sent to the patient, and the obligation would include the ID of the patient to receive the notification and the message contained in the notification.

Axiomatics
The Visual Studio Code extension for ALFA was developed by Axiomatics.
FOLLOW US