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 · 7.8 KB · 53 lines
| 1 | { |
| 2 | "retracted": [ |
| 3 | {"effect": "allow", "principal": "public", "actions": ["execute"], "object_id": "site_orders", "reason": "no package ships this object, so the grant made whatever was later created under the id runnable without a rule written for it (bug-reports/2026-11-28-06-14-43)"}, |
| 4 | {"effect": "allow", "principal": "public", "actions": ["execute"], "object_id": "site_order_view", "reason": "an earlier version's grant for an object this package no longer ships"} |
| 5 | ], |
| 6 | "rules": [ |
| 7 | { |
| 8 | "effect": "allow", |
| 9 | "principal": "registered", |
| 10 | "actions": ["create", "read", "update", "delete"], |
| 11 | "collection": "orders", |
| 12 | "row_filter": {"owner_id": "$user_id"}, |
| 13 | "reason": "signed-in users manage sales and purchase orders they created" |
| 14 | }, |
| 15 | { |
| 16 | "effect": "allow", |
| 17 | "principal": "registered", |
| 18 | "actions": ["create", "read", "update", "delete"], |
| 19 | "collection": "order_lines", |
| 20 | "row_filter": {"owner_id": "$user_id"}, |
| 21 | "reason": "signed-in users manage line items on orders they created" |
| 22 | }, |
| 23 | { |
| 24 | "effect": "allow", |
| 25 | "principal": "public", |
| 26 | "actions": ["execute"], |
| 27 | "object_id": "site_order_status", |
| 28 | "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" |
| 29 | }, |
| 30 | { |
| 31 | "effect": "allow", |
| 32 | "principal": "registered", |
| 33 | "actions": ["execute"], |
| 34 | "object_id": "action_dropship_order", |
| 35 | "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" |
| 36 | }, |
| 37 | { |
| 38 | "effect": "allow", |
| 39 | "principal": "registered", |
| 40 | "actions": ["execute"], |
| 41 | "object_id": "site_dropship_margin", |
| 42 | "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" |
| 43 | }, |
| 44 | {"effect": "allow", "principal": "role:cashier", "actions": ["read"], "collection": "orders", "reason": "staff read the shop's orders and their lines whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"}, |
| 45 | {"effect": "allow", "principal": "role:shift_lead", "actions": ["read"], "collection": "orders", "reason": "staff read the shop's orders and their lines whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"}, |
| 46 | {"effect": "allow", "principal": "role:manager", "actions": ["read"], "collection": "orders", "reason": "staff read the shop's orders and their lines whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"}, |
| 47 | {"effect": "allow", "principal": "role:owner", "actions": ["read"], "collection": "orders", "reason": "staff read the shop's orders and their lines whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"}, |
| 48 | {"effect": "allow", "principal": "role:cashier", "actions": ["read"], "collection": "order_lines", "reason": "staff read the shop's orders and their lines whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"}, |
| 49 | {"effect": "allow", "principal": "role:shift_lead", "actions": ["read"], "collection": "order_lines", "reason": "staff read the shop's orders and their lines whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"}, |
| 50 | {"effect": "allow", "principal": "role:manager", "actions": ["read"], "collection": "order_lines", "reason": "staff read the shop's orders and their lines whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"}, |
| 51 | {"effect": "allow", "principal": "role:owner", "actions": ["read"], "collection": "order_lines", "reason": "staff read the shop's orders and their lines whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"} |
| 52 | ] |
| 53 | } |