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.5 KB · 48 lines
| 1 | { |
| 2 | "rules": [ |
| 3 | { |
| 4 | "effect": "allow", |
| 5 | "principal": "registered", |
| 6 | "actions": ["create", "read", "update", "delete"], |
| 7 | "collection": "orders", |
| 8 | "row_filter": {"owner_id": "$user_id"}, |
| 9 | "reason": "signed-in users manage sales and purchase orders they created" |
| 10 | }, |
| 11 | { |
| 12 | "effect": "allow", |
| 13 | "principal": "registered", |
| 14 | "actions": ["create", "read", "update", "delete"], |
| 15 | "collection": "order_lines", |
| 16 | "row_filter": {"owner_id": "$user_id"}, |
| 17 | "reason": "signed-in users manage line items on orders they created" |
| 18 | }, |
| 19 | { |
| 20 | "effect": "allow", |
| 21 | "principal": "public", |
| 22 | "actions": ["execute"], |
| 23 | "object_id": "site_orders", |
| 24 | "reason": "the orders page is public; it shows a sign-in prompt to visitors" |
| 25 | }, |
| 26 | { |
| 27 | "effect": "allow", |
| 28 | "principal": "public", |
| 29 | "actions": ["execute"], |
| 30 | "object_id": "site_order_status", |
| 31 | "reason": "the /orders/track/{token} page is public by design -- this shop's default sale is a guest checkout, so the buyer has no account to sign into and no other way to ask where their order is. The object resolves the order by portal_token with a constant-time compare, never by id, so there is no enumeration path from a guessed order id, and an unknown or blank token gets the same friendly 404 as one that never existed. Public EXECUTE on the page object only -- the orders collection itself stays owner-scoped, exactly the split app-invoices uses for site_invoice_portal" |
| 32 | }, |
| 33 | { |
| 34 | "effect": "allow", |
| 35 | "principal": "registered", |
| 36 | "actions": ["execute"], |
| 37 | "object_id": "action_dropship_order", |
| 38 | "reason": "choosing to have a vendor ship an order is ordinary commercial work, not owner-only work: anybody signed in can raise the purchase order, and what they can raise it against is bounded by the action's own gates -- a sale order only, never one already linked, and never one whose goods have already come off our shelf" |
| 39 | }, |
| 40 | { |
| 41 | "effect": "allow", |
| 42 | "principal": "registered", |
| 43 | "actions": ["execute"], |
| 44 | "object_id": "site_dropship_margin", |
| 45 | "reason": "registered rather than public, unlike the tracking page beside it: what a shop paid a vendor and what it charged the customer is the most commercially sensitive pair of numbers in this package, and the page is addressed by an internal order id -- public execute would make it an enumeration oracle for the whole margin book. The page shows a sign-in prompt rather than an error to anyone who is not" |
| 46 | } |
| 47 | ] |
| 48 | } |