yuhanzippy
09/20/2023, 12:56 AMexist
/`not_exist` operator to check if the relationship exist? This is useful to implement conditional rules that's based on the existence of the relationship data. for instance:
definition document {
relation approver: user
relation reviewer: user
relation commenter: user
permission read = exist(approver) & reviewer + not_exist(approver) & commenter
}
This is an example to express different read permissions based on whether a document has been approved or not