axoxymous
06/14/2024, 5:50 AMdefinition user {}
// caveat for a loan to be approved by a bank employee
caveat check(user_location string, loan_location string, user_department string, loan_type string, user_designation string, allowed_designation string) {
user_location == loan_location && user_department == loan_type && user_designation == allowed_designation
}
definition loan {
relation operator: user with check // user can operate on a loan if checks are fulfilled
permission operate = operator
}
definition location {
relation work: user // employee has a base location
relation pos: loan // loan's place of sanction
}
definition designation {
relation hold: user // users holds a designation
}
definition department {
relation belong: user // employee belongs to a department
relation handle: loan // loan is handled by a department
}
Continue to next message...