askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
rules.json · 2.4 KB · 25 lines
| 1 | { |
| 2 | "rules": [ |
| 3 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update", "delete"], |
| 4 | "collection": "supplier_bills", "row_filter": {"owner_id": "$user_id"}, |
| 5 | "reason": "people keep the bills their suppliers send them in their own books, as with invoices; an approved, paid or exchanged bill cannot be deleted or rewritten (locked_when)"}, |
| 6 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update", "delete"], |
| 7 | "collection": "supplier_bill_lines", "row_filter": {"owner_id": "$user_id"}, |
| 8 | "reason": "the lines of a person's own supplier bills; bill_id requires update on the bill, and exchanged lines are frozen"}, |
| 9 | {"effect": "allow", "principal": "registered", "actions": ["create", "read"], |
| 10 | "collection": "supplier_payments", "row_filter": {"owner_id": "$user_id"}, |
| 11 | "reason": "people record what they paid their suppliers in their own books"}, |
| 12 | {"effect": "allow", "principal": "registered", "actions": ["update", "delete"], |
| 13 | "collection": "supplier_payments", "row_filter": {"owner_id": "$user_id", "remitted": "false"}, |
| 14 | "reason": "a payment is its owner's to correct until the supplier is told (remitted); after that it is a fact both companies hold, and because a line needs update on its payment, no line can be added to it either"}, |
| 15 | {"effect": "deny", "principal": "owner_fallback", "actions": ["update", "delete"], |
| 16 | "collection": "supplier_payments", |
| 17 | "reason": "without this the owner fallback would hand the owner of a remitted payment the update the rule above withholds, and with it new lines on a payment the supplier has already been told about"}, |
| 18 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update", "delete"], |
| 19 | "collection": "supplier_payment_lines", "row_filter": {"owner_id": "$user_id"}, |
| 20 | "reason": "how much of a person's own payment went to which of their bills; payment_id requires update on the payment, so a remitted payment takes no new line, and a remitted line is frozen (locked_when)"}, |
| 21 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update", "delete"], |
| 22 | "collection": "supplier_bill_credits", "row_filter": {"owner_id": "$user_id"}, |
| 23 | "reason": "a person applies a supplier's credit note to one of their bills; one made from the supplier's signed credit note is frozen but for which bill an on-account credit goes to (locked_when)"} |
| 24 | ] |
| 25 | } |