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 · 11.3 KB · 113 lines
| 1 | { |
| 2 | "retracted": [ |
| 3 | {"effect": "allow", "principal": "public", "actions": ["execute"], "object_id": "site_invoices", "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_invoice_view", "reason": "an earlier version's grant for an object this package no longer ships"}, |
| 5 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update", "delete"], "collection": "invoices", "row_filter": {"owner_id": "$user_id"}, "reason": "withdrawn in 0.15.0: an invoice raised by checkout or by a subscription is owned by the customer it bills, and delete let that customer erase what they owe (an issued invoice is voided, never deleted). Replaced by the same grant without delete"}, |
| 6 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update", "delete"], "collection": "invoice_lines", "row_filter": {"owner_id": "$user_id"}, "reason": "withdrawn in 0.15.0: deleting a line of a customer-owned invoice restated the bill. Replaced by the same grant without delete"} |
| 7 | ], |
| 8 | "rules": [ |
| 9 | { |
| 10 | "effect": "deny", |
| 11 | "principal": "owner_fallback", |
| 12 | "actions": ["delete"], |
| 13 | "collection": "invoices", |
| 14 | "reason": "an issued invoice is voided, never deleted, and the person an invoice names as owner is the customer it bills when checkout or a subscription raised it, or the staff member who raised it when staff did, by hand or from hours. No rule grants delete; this switches the engine's owner fallback off for it, so the owner cannot erase the debt. Admins and in-process writers are unaffected" |
| 15 | }, |
| 16 | { |
| 17 | "effect": "deny", |
| 18 | "principal": "owner_fallback", |
| 19 | "actions": ["delete"], |
| 20 | "collection": "invoice_lines", |
| 21 | "reason": "removing a line restates the bill it belongs to, and the line's owner is the invoice's owner -- the customer being billed when checkout or a subscription raised the invoice, the staff member who raised it when staff did, by hand or from hours. No rule grants delete; this switches the owner fallback off for it. Admins and in-process writers are unaffected" |
| 22 | }, |
| 23 | { |
| 24 | "effect": "allow", |
| 25 | "principal": "registered", |
| 26 | "actions": [ |
| 27 | "create", |
| 28 | "read", |
| 29 | "update" |
| 30 | ], |
| 31 | "collection": "invoices", |
| 32 | "row_filter": { |
| 33 | "owner_id": "$user_id" |
| 34 | }, |
| 35 | "reason": "signed-in users read the invoices, quotes and credit notes that are theirs, and may draft one. What they may change is narrowed by the schema's field permissions: the status, the dates, the totals, the dunning stamps and the tokens are staff's (role:manager, role:admin) and the platform's reactions', because the owner of a checkout or subscription invoice is the customer being billed. No delete (0.15.0)" |
| 36 | }, |
| 37 | { |
| 38 | "effect": "allow", |
| 39 | "principal": "registered", |
| 40 | "actions": [ |
| 41 | "create", |
| 42 | "read", |
| 43 | "update" |
| 44 | ], |
| 45 | "collection": "invoice_lines", |
| 46 | "row_filter": { |
| 47 | "owner_id": "$user_id" |
| 48 | }, |
| 49 | "reason": "signed-in users read the lines of their own documents. Which invoice a line is on and everything it charges are staff-only field permissions in invoice_lines.json; no delete (0.15.0)" |
| 50 | }, |
| 51 | { |
| 52 | "effect": "allow", |
| 53 | "principal": "role:manager", |
| 54 | "actions": [ |
| 55 | "create", |
| 56 | "read", |
| 57 | "update" |
| 58 | ], |
| 59 | "collection": "invoices", |
| 60 | "reason": "billing staff: the role that already decides when approved hours go out as an invoice (action_generate_tm_invoice) sends, voids and corrects invoices, including the customer-owned ones checkout and the subscription biller raise. Not delete: an issued invoice is voided" |
| 61 | }, |
| 62 | { |
| 63 | "effect": "allow", |
| 64 | "principal": "role:manager", |
| 65 | "actions": [ |
| 66 | "create", |
| 67 | "read", |
| 68 | "update" |
| 69 | ], |
| 70 | "collection": "invoice_lines", |
| 71 | "reason": "billing staff write the lines of any invoice; the totals handler restamps the header from them" |
| 72 | }, |
| 73 | { |
| 74 | "effect": "allow", |
| 75 | "principal": "public", |
| 76 | "actions": [ |
| 77 | "execute" |
| 78 | ], |
| 79 | "object_id": "site_invoice_portal", |
| 80 | "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" |
| 81 | }, |
| 82 | { |
| 83 | "effect": "allow", |
| 84 | "principal": "registered", |
| 85 | "actions": [ |
| 86 | "execute" |
| 87 | ], |
| 88 | "object_id": "action_regenerate_portal_link", |
| 89 | "reason": "regenerating a portal link is the correct response to a leaked one; the object enforces owner-or-admin on the target invoice" |
| 90 | }, |
| 91 | { |
| 92 | "effect": "allow", |
| 93 | "principal": "role:manager", |
| 94 | "actions": [ |
| 95 | "execute" |
| 96 | ], |
| 97 | "object_id": "action_generate_tm_invoice", |
| 98 | "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" |
| 99 | }, |
| 100 | {"effect": "allow", "principal": "role:manager", "actions": ["create", "read", "update", "delete"], "collection": "invoice_credits", "reason": "billing staff apply a credit note to an invoice (or leave it on the customer's account) and correct a manual application; one sent to a partner's box (source exchange) is frozen by locked_when"}, |
| 101 | {"effect": "allow", "principal": "registered", "actions": ["read"], "collection": "invoice_credits", "row_filter": {"owner_id": "$user_id"}, "reason": "a customer sees the credits applied to their own invoices"}, |
| 102 | {"effect": "deny", "principal": "owner_fallback", "actions": ["update", "delete"], "collection": "invoice_credits", "reason": "applying a credit moves money on an invoice, which is staff's (app-invoices 0.15.0): the customer who owns the credit note reads its application and does not change or remove it"}, |
| 103 | {"effect": "allow", "principal": "role:cashier", "actions": ["read"], "collection": "invoices", "reason": "staff read the shop's invoices and their lines (role:manager already reads and writes them) 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"}, |
| 104 | {"effect": "allow", "principal": "role:shift_lead", "actions": ["read"], "collection": "invoices", "reason": "staff read the shop's invoices and their lines (role:manager already reads and writes them) 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"}, |
| 105 | {"effect": "allow", "principal": "role:owner", "actions": ["read"], "collection": "invoices", "reason": "staff read the shop's invoices and their lines (role:manager already reads and writes them) 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"}, |
| 106 | {"effect": "allow", "principal": "role:cashier", "actions": ["read"], "collection": "invoice_lines", "reason": "staff read the shop's invoices and their lines (role:manager already reads and writes them) 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"}, |
| 107 | {"effect": "allow", "principal": "role:shift_lead", "actions": ["read"], "collection": "invoice_lines", "reason": "staff read the shop's invoices and their lines (role:manager already reads and writes them) 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"}, |
| 108 | {"effect": "allow", "principal": "role:owner", "actions": ["read"], "collection": "invoice_lines", "reason": "staff read the shop's invoices and their lines (role:manager already reads and writes them) 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"}, |
| 109 | {"effect": "allow", "principal": "role:cashier", "actions": ["read"], "collection": "invoice_credits", "reason": "staff read the credits applied to the shop's invoices, as they read the invoices themselves (role:manager already reads and writes them): a credit note issued at the counter is applied by an invoice_credits row, and without it a cashier sees an invoice's balance fall with no row saying why. Read only"}, |
| 110 | {"effect": "allow", "principal": "role:shift_lead", "actions": ["read"], "collection": "invoice_credits", "reason": "staff read the credits applied to the shop's invoices, as they read the invoices themselves (role:manager already reads and writes them): a credit note issued at the counter is applied by an invoice_credits row, and without it a cashier sees an invoice's balance fall with no row saying why. Read only"}, |
| 111 | {"effect": "allow", "principal": "role:owner", "actions": ["read"], "collection": "invoice_credits", "reason": "staff read the credits applied to the shop's invoices, as they read the invoices themselves (role:manager already reads and writes them): a credit note issued at the counter is applied by an invoice_credits row, and without it a cashier sees an invoice's balance fall with no row saying why. Read only"} |
| 112 | ] |
| 113 | } |