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 · 4.5 KB · 64 lines
| 1 | { |
| 2 | "rules": [ |
| 3 | {"effect": "deny", "principal": "owner_fallback", "actions": ["delete"], "collection": "shipments", "reason": "a parcel that went out cannot be made not to have gone out: no delete. No rule grants this; the engine's owner fallback did, to whoever the row's owner key names. This switches the fallback off for these actions only: an explicit grant still grants, and admins and in-process writers are unaffected"}, |
| 4 | {"effect": "deny", "principal": "owner_fallback", "actions": ["delete"], "collection": "shipment_lines", "reason": "the lines are the shipment: no delete. No rule grants this; the engine's owner fallback did, to whoever the row's owner key names. This switches the fallback off for these actions only: an explicit grant still grants, and admins and in-process writers are unaffected"}, |
| 5 | { |
| 6 | "effect": "allow", |
| 7 | "principal": "registered", |
| 8 | "actions": ["create", "read", "update"], |
| 9 | "collection": "shipments", |
| 10 | "row_filter": {"owner_id": "$user_id"}, |
| 11 | "reason": "a shipment is the operator's own paperwork about their own goods; no delete, because a parcel that went out cannot be made not to have gone out -- a mistake is a lost/returned status or an inbound shipment, never a vanished row" |
| 12 | }, |
| 13 | { |
| 14 | "effect": "allow", |
| 15 | "principal": "registered", |
| 16 | "actions": ["create", "read", "update"], |
| 17 | "collection": "shipment_lines", |
| 18 | "row_filter": {"owner_id": "$user_id"}, |
| 19 | "reason": "the lines are the shipment; same scope and the same no-delete posture, and the over-shipping gate in hook_shipment_lines runs on this path whoever the caller is" |
| 20 | }, |
| 21 | { |
| 22 | "effect": "allow", |
| 23 | "principal": "registered", |
| 24 | "actions": ["execute"], |
| 25 | "object_id": "action_create_shipment", |
| 26 | "reason": "anybody signed in may run it; what it then does is decided per order -- the action asks the permission engine whether the caller may update the order it would pack (a packer is somebody the policy lets update the shop's orders), and everything that can go in the box is bounded by what the order already committed to" |
| 27 | }, |
| 28 | { |
| 29 | "effect": "allow", |
| 30 | "principal": "registered", |
| 31 | "actions": ["execute"], |
| 32 | "object_id": "site_packing_slip", |
| 33 | "reason": "operator-facing, deliberately NOT public: the slip is addressed by an internal shipment id, so a public page here would be an enumeration oracle for every parcel in the shop. The customer's door is the payment portal's capability token, which is unguessable and revocable; a slip is printed by the person holding the box" |
| 34 | }, |
| 35 | { |
| 36 | "effect": "allow", |
| 37 | "principal": "registered", |
| 38 | "actions": ["execute"], |
| 39 | "object_id": "site_pick_list", |
| 40 | "reason": "the picker has to be signed in for the page to know whose warehouse to fold; the page itself shows a sign-in prompt rather than an error to anyone who is not" |
| 41 | }, |
| 42 | { |
| 43 | "effect": "allow", |
| 44 | "principal": "registered", |
| 45 | "actions": ["execute"], |
| 46 | "object_id": "site_manifest", |
| 47 | "reason": "same gate as the pick list and for the same reason: the page folds the signed-in operator's own dock, and it shows a sign-in prompt rather than an error to anybody else. Deliberately not public even though a driver reads it -- the paper in their hand is the copy they get, and a public URL listing every parcel, its destination and its tracking number would be a delivery-route map for anyone who guessed the date" |
| 48 | }, |
| 49 | { |
| 50 | "effect": "allow", |
| 51 | "principal": "registered", |
| 52 | "actions": ["execute"], |
| 53 | "object_id": "action_buy_label", |
| 54 | "reason": "anybody signed in may run it, and it is bounded on every side: it asks the permission engine whether the caller may update the shipment it would label, it writes nothing but a tracking number and a label file onto one existing shipment, it refuses a parcel whose journey is already over, and with no carrier configured it can only record what an operator typed. The money a real carrier adapter can spend is bounded by that adapter's own credentials, which a signed-in packer does not hold" |
| 55 | }, |
| 56 | { |
| 57 | "effect": "allow", |
| 58 | "principal": "registered", |
| 59 | "actions": ["execute"], |
| 60 | "object_id": "system_tracking_poll", |
| 61 | "reason": "the scheduler runs this hourly, and an operator watching a parcel should be able to poke it in between without an admin token: it only writes back what the carrier said, and the one derived move it makes (delivered) is the move the carrier just reported" |
| 62 | } |
| 63 | ] |
| 64 | } |