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 · 3.7 KB · 37 lines
| 1 | { |
| 2 | "retracted": [ |
| 3 | {"effect": "deny", "principal": "owner_fallback", "actions": ["delete"], "collection": "pickup_slots", "reason": "replaced in 0.1.3 by the same opt-out covering update as well"}, |
| 4 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update"], "collection": "pickup_slots", "reason": "withdrawn in 0.1.3: it let any signed-in customer of a public shop raise a slot's capacity, reopen a closed window, rewrite orders_taken or post a window of their own onto the public time picker (bug-reports 2026-11-30, café run). Slots are shop configuration; customers read them and the checkout counts them as a trusted writer"} |
| 5 | ], |
| 6 | "rules": [ |
| 7 | {"effect": "deny", "principal": "owner_fallback", "actions": ["update", "delete"], "collection": "pickup_slots", "reason": "a window somebody may have booked into is closed with is_open=false, never deleted; and it is edited by the shop's managers, not by whoever happens to be named as its owner -- a manager who created a slot and has since lost the role must not keep editing it through the fallback. No rule grants delete; this switches the fallback off for these actions only: the manager grant still grants update, and admins and in-process writers are unaffected"}, |
| 8 | { |
| 9 | "effect": "allow", |
| 10 | "principal": "registered", |
| 11 | "actions": ["read"], |
| 12 | "collection": "pickup_slots", |
| 13 | "reason": "the board of collection windows is shop-wide furniture, read by every storefront render, so it is deliberately NOT row-filtered to an owner the way orders and shipments are. READ ONLY: on a public shop every customer is a registered user, and a grant of update here let any of them raise a slot's capacity or rewrite orders_taken through PUT /collections/pickup_slots/records/{id}. Writing the board is the manager rule below; counting a booking is action_checkout, a trusted server-side writer that asks no rule" |
| 14 | }, |
| 15 | { |
| 16 | "effect": "allow", |
| 17 | "principal": "role:manager", |
| 18 | "actions": ["create", "read", "update"], |
| 19 | "collection": "pickup_slots", |
| 20 | "reason": "whoever runs the shift opens, closes and resizes windows -- the same role that already makes the shop's other operational calls (role:manager in app-invoices, app-timers, app-nav). No delete, for the same reason a shipment has none: a window somebody has already booked into cannot be made not to have existed, and the way to stop taking orders for it is is_open=false, which keeps the orders that are already in it" |
| 21 | }, |
| 22 | { |
| 23 | "effect": "allow", |
| 24 | "principal": "public", |
| 25 | "actions": ["execute"], |
| 26 | "object_id": "action_pickup_slots", |
| 27 | "reason": "PUBLIC on the action object only, never on the collection: this shop's default sale is a guest checkout, so the person choosing a collection time has no account and this is the read their time picker is built from. What it hands back is bounded to exactly what a shop puts on a sign in its window -- the times it is open and whether each is full -- with no owner, no notes and no order behind them, and it can write nothing at all. The collection itself stays registered-only, which is the same split app-invoices uses for site_invoice_portal and app-orders for site_order_status" |
| 28 | }, |
| 29 | { |
| 30 | "effect": "allow", |
| 31 | "principal": "registered", |
| 32 | "actions": ["execute"], |
| 33 | "object_id": "system_slot_generator", |
| 34 | "reason": "the scheduler runs this nightly, and an operator who has just changed their opening hours should be able to poke it without an admin token: it only ever ADDS windows that its own settings describe, never edits or deletes one somebody made, so the worst a signed-in person can do with it is create tomorrow twice -- which its (starts_at, location) idempotency makes a no-op" |
| 35 | } |
| 36 | ] |
| 37 | } |