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 · 2.8 KB · 28 lines
| 1 | { |
| 2 | "rules": [ |
| 3 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update", "delete"], |
| 4 | "collection": "fixed_assets", "row_filter": {"owner_id": "$user_id"}, |
| 5 | "reason": "people keep the register of the assets in their own books, as with the rest of finance; an asset in service or disposed cannot be deleted (locked_when), a draft can"}, |
| 6 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update", "delete"], |
| 7 | "collection": "asset_work", "row_filter": {"owner_id": "$user_id"}, |
| 8 | "reason": "people record improvements and repairs to their own assets; a booked one is frozen (locked_when), and asset_id requires update on the asset"}, |
| 9 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update", "delete"], |
| 10 | "collection": "asset_disposals", "row_filter": {"owner_id": "$user_id"}, |
| 11 | "reason": "people record how their own assets left the business; a booked disposal is frozen (locked_when), and asset_id requires update on the asset"}, |
| 12 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update", "delete"], |
| 13 | "collection": "asset_tax_entries", "row_filter": {"owner_id": "$user_id"}, |
| 14 | "reason": "people type in the tax figures their accountant gave them for their own assets; nothing books them"}, |
| 15 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update"], |
| 16 | "collection": "loss_events", "row_filter": {"owner_id": "$user_id"}, |
| 17 | "reason": "people report losses in their own books and follow the insurance claim; approval is somebody else's (hook_loss_events), and there is no delete: a mistaken report is rejected, not removed"}, |
| 18 | {"effect": "allow", "principal": "role:manager", "actions": ["read", "update"], |
| 19 | "collection": "loss_events", |
| 20 | "reason": "approving a loss means acting on somebody else's report, which the owner-filtered rule deliberately cannot do; the hook and the locked check still refuse the reporter's own approval"}, |
| 21 | {"effect": "deny", "principal": "owner_fallback", "actions": ["delete"], "collection": "loss_events", |
| 22 | "reason": "a loss report is evidence: a mistaken one is rejected, never deleted. No rule grants delete; the engine's owner fallback did, to whoever owner_id names. This switches the fallback off for delete only"}, |
| 23 | {"effect": "allow", "principal": "registered", "actions": ["execute"], "object_id": "action_asset_books", |
| 24 | "reason": "booking the register now, or reading one asset's schedule; the object asks object_access for update (POST) or read (GET) on each record it touches"}, |
| 25 | {"effect": "allow", "principal": "public", "actions": ["execute"], "object_id": "site_asset_schedule", |
| 26 | "reason": "the asset page shows a sign-in prompt to visitors; for a signed-in viewer it gates the asset through object_access before reading anything"} |
| 27 | ] |
| 28 | } |