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 · 6.8 KB · 152 lines
| 1 | { |
| 2 | "retracted": [ |
| 3 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update", "delete"], "collection": "bank_accounts", "row_filter": {"owner_id": "$user_id"}, "reason": "bank_accounts was replaced by value_accounts in 0.4.0; this grant is for a collection the package no longer ships"} |
| 4 | ], |
| 5 | "rules": [ |
| 6 | {"effect": "deny", "principal": "owner_fallback", "actions": ["delete"], "collection": "bank_lines", "reason": "imported bank evidence is append-only and is never deleted. 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"}, |
| 7 | {"effect": "deny", "principal": "owner_fallback", "actions": ["update", "delete"], "collection": "bank_statement_imports", "reason": "an import run is a historical event, never updated or deleted. 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"}, |
| 8 | {"effect": "deny", "principal": "owner_fallback", "actions": ["update", "delete"], "collection": "value_account_counts", "reason": "a count is evidence, never updated or deleted. 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"}, |
| 9 | { |
| 10 | "effect": "allow", |
| 11 | "principal": "registered", |
| 12 | "actions": [ |
| 13 | "create", |
| 14 | "read", |
| 15 | "update", |
| 16 | "delete" |
| 17 | ], |
| 18 | "collection": "bank_import_profiles", |
| 19 | "row_filter": { |
| 20 | "owner_id": "$user_id" |
| 21 | }, |
| 22 | "reason": "an import profile is the user's own how-to-read-my-bank configuration" |
| 23 | }, |
| 24 | { |
| 25 | "effect": "allow", |
| 26 | "principal": "registered", |
| 27 | "actions": [ |
| 28 | "create", |
| 29 | "read" |
| 30 | ], |
| 31 | "collection": "bank_statement_imports", |
| 32 | "row_filter": { |
| 33 | "owner_id": "$user_id" |
| 34 | }, |
| 35 | "reason": "import runs are historical events: readable and creatable by their owner, never updatable or deletable -- the provenance record for imported evidence must not be rewritable" |
| 36 | }, |
| 37 | { |
| 38 | "effect": "allow", |
| 39 | "principal": "registered", |
| 40 | "actions": [ |
| 41 | "create", |
| 42 | "read", |
| 43 | "update" |
| 44 | ], |
| 45 | "collection": "bank_lines", |
| 46 | "row_filter": { |
| 47 | "owner_id": "$user_id" |
| 48 | }, |
| 49 | "reason": "owners read and import their own statement lines, and UPDATE only to record reconciliation work (match_status/matched_to/resolved_as) -- which is attributed in the change log, so who reconciled what is auditable. No delete: imported evidence is append-only, and the transitions on match_status constrain what an update may do to it" |
| 50 | }, |
| 51 | { |
| 52 | "effect": "allow", |
| 53 | "principal": "registered", |
| 54 | "actions": [ |
| 55 | "execute" |
| 56 | ], |
| 57 | "object_id": "action_import_bank_csv", |
| 58 | "reason": "importing a statement is an ordinary operator verb; the object requires a signed-in identity and verifies the bank account belongs to the caller" |
| 59 | }, |
| 60 | { |
| 61 | "effect": "allow", |
| 62 | "principal": "registered", |
| 63 | "actions": [ |
| 64 | "execute" |
| 65 | ], |
| 66 | "object_id": "action_resolve_bank_line", |
| 67 | "reason": "resolving a line as a fee, interest, transfer or NSF is an ordinary operator verb; the object checks ownership of the line (and of any counterpart account) and composes through the shared journal composer, which is idempotent by provenance" |
| 68 | }, |
| 69 | { |
| 70 | "effect": "allow", |
| 71 | "principal": "registered", |
| 72 | "actions": [ |
| 73 | "execute" |
| 74 | ], |
| 75 | "object_id": "system_bank_matcher", |
| 76 | "reason": "the matcher only ever writes SUGGESTIONS onto the caller's own unmatched lines (and auto-confirms solely at the configured tier), so running it is safe for any signed-in owner as well as the scheduler" |
| 77 | }, |
| 78 | { |
| 79 | "effect": "allow", |
| 80 | "principal": "public", |
| 81 | "actions": [ |
| 82 | "execute" |
| 83 | ], |
| 84 | "object_id": "site_reconcile", |
| 85 | "reason": "page objects are public execute like every other site_* page (see packages/app-finance's site_trial_balance rule); the object itself gates all data on a signed-in identity and scopes every read to the caller's own bank accounts and lines, so an anonymous or cross-owner request never sees another owner's reconciliation" |
| 86 | }, |
| 87 | { |
| 88 | "effect": "allow", |
| 89 | "principal": "registered", |
| 90 | "actions": [ |
| 91 | "create", |
| 92 | "read", |
| 93 | "update", |
| 94 | "delete" |
| 95 | ], |
| 96 | "collection": "value_accounts", |
| 97 | "row_filter": { |
| 98 | "owner_id": "$user_id" |
| 99 | }, |
| 100 | "reason": "signed-in users manage their own value accounts; managed_by names who runs one day to day but ownership still governs the record itself" |
| 101 | }, |
| 102 | { |
| 103 | "effect": "allow", |
| 104 | "principal": "registered", |
| 105 | "actions": [ |
| 106 | "execute" |
| 107 | ], |
| 108 | "object_id": "system_bank_escalation", |
| 109 | "reason": "the runner only reads bank_lines/payments and creates tasks scoped to the item's own owner (or reconcile.escalate_to), so running it is safe for any signed-in owner as well as the scheduler" |
| 110 | }, |
| 111 | { |
| 112 | "effect": "allow", |
| 113 | "principal": "registered", |
| 114 | "actions": [ |
| 115 | "execute" |
| 116 | ], |
| 117 | "object_id": "action_import_ofx", |
| 118 | "reason": "same posture as the CSV importer: a signed-in operator verb that verifies the bank account belongs to the caller before reading anything" |
| 119 | }, |
| 120 | { |
| 121 | "effect": "allow", |
| 122 | "principal": "registered", |
| 123 | "actions": [ |
| 124 | "create", |
| 125 | "read" |
| 126 | ], |
| 127 | "collection": "value_account_counts", |
| 128 | "row_filter": { |
| 129 | "owner_id": "$user_id" |
| 130 | }, |
| 131 | "reason": "a count is evidence: its owner may record and read one, and nobody may update or delete it -- an observation made by a named person at a moment is not a figure to revise later" |
| 132 | }, |
| 133 | { |
| 134 | "effect": "allow", |
| 135 | "principal": "registered", |
| 136 | "actions": [ |
| 137 | "execute" |
| 138 | ], |
| 139 | "object_id": "action_record_count", |
| 140 | "reason": "recording a count is an ordinary operator verb; the object verifies the account belongs to the caller, refuses accounts that are not counted by hand, and enforces the witness requirement" |
| 141 | }, |
| 142 | { |
| 143 | "effect": "allow", |
| 144 | "principal": "registered", |
| 145 | "actions": [ |
| 146 | "execute" |
| 147 | ], |
| 148 | "object_id": "action_confirm_count", |
| 149 | "reason": "a named witness confirms a count from their own sign-in; the object answers only the user a count names as its witness (never the counter, a third user or an admin on their behalf), lists only that user's pending counts without their figures, and writes once" |
| 150 | } |
| 151 | ] |
| 152 | } |