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.
danq9
signup: the person chooses the password and name on the confirm page
83c7aa6
2 weeks, 5 days ago
History
rules.json · 2.0 KB · 70 lines
| 1 | { |
| 2 | "rules": [ |
| 3 | { |
| 4 | "effect": "allow", |
| 5 | "principal": "registered", |
| 6 | "actions": [ |
| 7 | "create", |
| 8 | "read", |
| 9 | "update", |
| 10 | "delete" |
| 11 | ], |
| 12 | "collection": "invoices", |
| 13 | "row_filter": { |
| 14 | "owner_id": "$user_id" |
| 15 | }, |
| 16 | "reason": "signed-in users manage invoices, quotes, and credit notes they created" |
| 17 | }, |
| 18 | { |
| 19 | "effect": "allow", |
| 20 | "principal": "registered", |
| 21 | "actions": [ |
| 22 | "create", |
| 23 | "read", |
| 24 | "update", |
| 25 | "delete" |
| 26 | ], |
| 27 | "collection": "invoice_lines", |
| 28 | "row_filter": { |
| 29 | "owner_id": "$user_id" |
| 30 | }, |
| 31 | "reason": "signed-in users manage line items on documents they created" |
| 32 | }, |
| 33 | { |
| 34 | "effect": "allow", |
| 35 | "principal": "public", |
| 36 | "actions": [ |
| 37 | "execute" |
| 38 | ], |
| 39 | "object_id": "site_invoices", |
| 40 | "reason": "the invoices page is public; it shows a sign-in prompt to visitors" |
| 41 | }, |
| 42 | { |
| 43 | "effect": "allow", |
| 44 | "principal": "public", |
| 45 | "actions": [ |
| 46 | "execute" |
| 47 | ], |
| 48 | "object_id": "site_invoice_portal", |
| 49 | "reason": "the /pay/{token} portal is public by design -- the payer has no account; the object looks the invoice up by portal_token with a constant-time compare, never by id, so there is no enumeration path, and it gates every state itself" |
| 50 | }, |
| 51 | { |
| 52 | "effect": "allow", |
| 53 | "principal": "registered", |
| 54 | "actions": [ |
| 55 | "execute" |
| 56 | ], |
| 57 | "object_id": "action_regenerate_portal_link", |
| 58 | "reason": "regenerating a portal link is the correct response to a leaked one; the object enforces owner-or-admin on the target invoice" |
| 59 | }, |
| 60 | { |
| 61 | "effect": "allow", |
| 62 | "principal": "role:manager", |
| 63 | "actions": [ |
| 64 | "execute" |
| 65 | ], |
| 66 | "object_id": "action_generate_tm_invoice", |
| 67 | "reason": "turning approved hours into an invoice is a billing decision; the approval that made those hours billable already happened, and this is the person who decides they go out now" |
| 68 | } |
| 69 | ] |
| 70 | } |