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.
danq9
signup: the person chooses the password and name on the confirm page
83c7aa6
2 weeks, 5 days ago
History
rules.json · 5.9 KB · 202 lines
| 1 | { |
| 2 | "rules": [ |
| 3 | { |
| 4 | "effect": "allow", |
| 5 | "principal": "registered", |
| 6 | "actions": [ |
| 7 | "read" |
| 8 | ], |
| 9 | "collection": "denominations", |
| 10 | "reason": "denominations are reference data, not private records: any signed-in user needs to know that BTC divides into eight places in order to render an amount correctly at all" |
| 11 | }, |
| 12 | { |
| 13 | "effect": "allow", |
| 14 | "principal": "registered", |
| 15 | "actions": [ |
| 16 | "create", |
| 17 | "update", |
| 18 | "delete" |
| 19 | ], |
| 20 | "collection": "denominations", |
| 21 | "row_filter": { |
| 22 | "owner_id": "$user_id" |
| 23 | }, |
| 24 | "reason": "operators may add their own units (a gift-card program, a loyalty point, a barter unit) but cannot edit the seeded ones everybody shares" |
| 25 | }, |
| 26 | { |
| 27 | "effect": "allow", |
| 28 | "principal": "public", |
| 29 | "actions": [ |
| 30 | "read" |
| 31 | ], |
| 32 | "collection": "denominations", |
| 33 | "row_filter": { |
| 34 | "is_system": "true" |
| 35 | }, |
| 36 | "reason": "public pages that display money (an invoice pay link, a storefront) must be able to resolve the scale of a standard unit; operator-defined denominations stay behind the sign-in because a custom code can name a business relationship" |
| 37 | }, |
| 38 | { |
| 39 | "effect": "allow", |
| 40 | "principal": "registered", |
| 41 | "actions": [ |
| 42 | "create", |
| 43 | "read" |
| 44 | ], |
| 45 | "collection": "rates", |
| 46 | "reason": "rates are shared observations: any signed-in user may read them (an amount cannot be valued without one) and may record one they fetched. No update or delete -- a restated rate is a new row with a later fetched_at, never an edit to what was recorded at the time" |
| 47 | }, |
| 48 | { |
| 49 | "effect": "allow", |
| 50 | "principal": "registered", |
| 51 | "actions": [ |
| 52 | "create", |
| 53 | "read", |
| 54 | "update", |
| 55 | "delete" |
| 56 | ], |
| 57 | "collection": "fin_accounts", |
| 58 | "row_filter": { |
| 59 | "owner_id": "$user_id" |
| 60 | }, |
| 61 | "reason": "signed-in users manage the chart of accounts they created" |
| 62 | }, |
| 63 | { |
| 64 | "effect": "allow", |
| 65 | "principal": "registered", |
| 66 | "actions": [ |
| 67 | "create", |
| 68 | "read", |
| 69 | "update", |
| 70 | "delete" |
| 71 | ], |
| 72 | "collection": "fin_journals", |
| 73 | "row_filter": { |
| 74 | "owner_id": "$user_id" |
| 75 | }, |
| 76 | "reason": "signed-in users manage journals they created, including the draft->posted transition guarded on the schema" |
| 77 | }, |
| 78 | { |
| 79 | "effect": "allow", |
| 80 | "principal": "registered", |
| 81 | "actions": [ |
| 82 | "create", |
| 83 | "read", |
| 84 | "update", |
| 85 | "delete" |
| 86 | ], |
| 87 | "collection": "fin_journal_lines", |
| 88 | "row_filter": { |
| 89 | "owner_id": "$user_id" |
| 90 | }, |
| 91 | "reason": "signed-in users manage line items on journals they created" |
| 92 | }, |
| 93 | { |
| 94 | "effect": "allow", |
| 95 | "principal": "registered", |
| 96 | "actions": [ |
| 97 | "create", |
| 98 | "read", |
| 99 | "update", |
| 100 | "delete" |
| 101 | ], |
| 102 | "collection": "fin_recurring", |
| 103 | "row_filter": { |
| 104 | "owner_id": "$user_id" |
| 105 | }, |
| 106 | "reason": "signed-in users manage recurring journal templates they created" |
| 107 | }, |
| 108 | { |
| 109 | "effect": "allow", |
| 110 | "principal": "public", |
| 111 | "actions": [ |
| 112 | "execute" |
| 113 | ], |
| 114 | "object_id": "site_accounts", |
| 115 | "reason": "the accounts page is public; it shows a sign-in prompt to visitors" |
| 116 | }, |
| 117 | { |
| 118 | "effect": "allow", |
| 119 | "principal": "public", |
| 120 | "actions": [ |
| 121 | "execute" |
| 122 | ], |
| 123 | "object_id": "site_journals", |
| 124 | "reason": "the journals page is public; it shows a sign-in prompt to visitors" |
| 125 | }, |
| 126 | { |
| 127 | "effect": "allow", |
| 128 | "principal": "public", |
| 129 | "actions": [ |
| 130 | "execute" |
| 131 | ], |
| 132 | "object_id": "site_trial_balance", |
| 133 | "reason": "the trial balance page is public; it shows a sign-in prompt to visitors and the page itself scopes the report to the signed-in owner (see objects/site/trial_balance.py)" |
| 134 | }, |
| 135 | { |
| 136 | "effect": "allow", |
| 137 | "principal": "public", |
| 138 | "actions": [ |
| 139 | "execute" |
| 140 | ], |
| 141 | "object_id": "site_setup_accounts", |
| 142 | "reason": "setup-accounts is public execute like every other finance page object; the object itself requires a signed-in identity and verifies the entity belongs to the caller before creating any account" |
| 143 | }, |
| 144 | { |
| 145 | "effect": "allow", |
| 146 | "principal": "registered", |
| 147 | "actions": [ |
| 148 | "execute" |
| 149 | ], |
| 150 | "object_id": "action_reverse_journal", |
| 151 | "reason": "reversing a posted journal is the doctrine-correct correction; the object itself enforces owner-or-admin on the target journal" |
| 152 | }, |
| 153 | { |
| 154 | "effect": "allow", |
| 155 | "principal": "public", |
| 156 | "actions": [ |
| 157 | "execute" |
| 158 | ], |
| 159 | "object_id": "site_statements", |
| 160 | "reason": "the statements page is public execute like every other finance page object; it shows a sign-in prompt to visitors and scopes both statements to the signed-in owner (see objects/site/statements.py)" |
| 161 | }, |
| 162 | { |
| 163 | "effect": "allow", |
| 164 | "principal": "registered", |
| 165 | "actions": [ |
| 166 | "create", |
| 167 | "read", |
| 168 | "update", |
| 169 | "delete" |
| 170 | ], |
| 171 | "collection": "fin_closed_periods", |
| 172 | "row_filter": { |
| 173 | "owner_id": "$user_id" |
| 174 | }, |
| 175 | "reason": "closing a period is creating a row; reopening -- rare and legitimate -- is deleting it, and both are attributed in the change log so 'who reopened March?' has an answer" |
| 176 | }, |
| 177 | { |
| 178 | "effect": "allow", |
| 179 | "principal": "registered", |
| 180 | "actions": [ |
| 181 | "create", |
| 182 | "read", |
| 183 | "update" |
| 184 | ], |
| 185 | "collection": "expenses", |
| 186 | "row_filter": { |
| 187 | "owner_id": "$user_id" |
| 188 | }, |
| 189 | "reason": "people record and submit their own spending" |
| 190 | }, |
| 191 | { |
| 192 | "effect": "allow", |
| 193 | "principal": "role:manager", |
| 194 | "actions": [ |
| 195 | "read", |
| 196 | "update" |
| 197 | ], |
| 198 | "collection": "expenses", |
| 199 | "reason": "approving spending means acting on somebody else's record, which the owner-filtered rule above deliberately cannot do; the hook still refuses self-approval" |
| 200 | } |
| 201 | ] |
| 202 | } |