Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 41 minutes ago History
rules.json · 7.9 KB · 192 lines
1{
2 "rules": [
3 {
4 "effect": "deny",
5 "principal": "owner_fallback",
6 "actions": [
7 "delete"
8 ],
9 "collection": "subscriptions",
10 "reason": "an agreement the biller has walked is canceled (cancel_at_period_end, or staff moving it to canceled), never deleted, and the person the row names as owner is the subscriber. No rule grants delete; this switches the engine's owner fallback off for it. Admins and in-process writers are unaffected"
11 },
12 {
13 "effect": "deny",
14 "principal": "owner_fallback",
15 "actions": [
16 "update",
17 "delete"
18 ],
19 "collection": "wallet_entries",
20 "reason": "the ledger is the balance: an entry is never edited or deleted, a mistake is a compensating entry. 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"
21 },
22 {
23 "effect": "deny",
24 "principal": "owner_fallback",
25 "actions": [
26 "delete"
27 ],
28 "collection": "wallets",
29 "reason": "a wallet is not its owner's to delete: its entries are the balance, and the update grant below is the whole of what an owner may write. 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"
30 },
31 {
32 "effect": "deny",
33 "principal": "owner_fallback",
34 "actions": [
35 "update",
36 "delete"
37 ],
38 "collection": "usage_events",
39 "reason": "a measurement of something that happened is never updated or deleted; a correction is a credit. 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"
40 },
41 {
42 "effect": "deny",
43 "principal": "owner_fallback",
44 "actions": [
45 "update",
46 "delete"
47 ],
48 "collection": "usage_summaries",
49 "reason": "the buckets a bill is computed from are written by the rollup pass alone. 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"
50 },
51 {
52 "effect": "allow",
53 "principal": "registered",
54 "actions": [
55 "read"
56 ],
57 "collection": "wallets",
58 "row_filter": {
59 "owner_id": "$user_id"
60 },
61 "reason": "a customer may always see their own balance and how it got there; they may not WRITE it -- the balance is a rollup, and the settings that drive auto top-up are changed through an owner-gated form, not by editing a number"
62 },
63 {
64 "effect": "allow",
65 "principal": "registered",
66 "actions": [
67 "update"
68 ],
69 "collection": "wallets",
70 "row_filter": {
71 "owner_id": "$user_id"
72 },
73 "reason": "owners tune their own auto top-up threshold, amount and cap; balance_minor is computed and refused by the write path regardless"
74 },
75 {
76 "effect": "allow",
77 "principal": "registered",
78 "actions": [
79 "read"
80 ],
81 "collection": "wallet_entries",
82 "row_filter": {
83 "owner_id": "$user_id"
84 },
85 "reason": "every customer can see exactly why their balance is what it is -- the statement is the ledger, not a summary of it. No create/update/delete: entries are written server-side by the metering, top-up and refund paths, and a client that could append its own credit could print money"
86 },
87 {
88 "effect": "allow",
89 "principal": "registered",
90 "actions": [
91 "read"
92 ],
93 "collection": "billing_plans",
94 "reason": "prices are not a secret from the people paying them; a customer may read the plan they are on and the ones they could move to"
95 },
96 {
97 "effect": "allow",
98 "principal": "role:admin",
99 "actions": [
100 "create",
101 "update",
102 "delete"
103 ],
104 "collection": "billing_plans",
105 "reason": "the price book is an operator surface -- and edits are constrained by convention, not permission: changing a price means adding a row, because an old invoice must keep showing what it charged"
106 },
107 {
108 "effect": "allow",
109 "principal": "registered",
110 "actions": [
111 "read",
112 "update"
113 ],
114 "collection": "subscriptions",
115 "row_filter": {
116 "owner_id": "$user_id"
117 },
118 "reason": "a subscriber reads their agreement and may ask to end it (cancel_at_period_end) or correct their billing name, email and notes -- the schema's field permissions make everything else (plan, mode, status, the period and trial dates, wallet, entity) staff's and the biller's. No create (a subscription a customer writes for themselves is service nobody sold them; signing up is staff's or a checkout's) and no delete (cancel_at_period_end is how an agreement ends)"
119 },
120 {
121 "effect": "allow",
122 "principal": "role:manager",
123 "actions": [
124 "create",
125 "read",
126 "update"
127 ],
128 "collection": "subscriptions",
129 "reason": "staff sign customers up, move them between plans and restore service once an invoice is paid; the same role that issues and corrects invoices (app-invoices) and refunds (app-payments). No delete: an agreement is canceled, never erased"
130 },
131 {
132 "effect": "allow",
133 "principal": "registered",
134 "actions": [
135 "create",
136 "read"
137 ],
138 "collection": "usage_events",
139 "row_filter": {
140 "owner_id": "$user_id"
141 },
142 "reason": "the metered service records its own usage and the customer can read every event behind a bill; nobody updates or deletes one -- a measurement of something that happened is not editable, and a correction is a credit"
143 },
144 {
145 "effect": "allow",
146 "principal": "registered",
147 "actions": [
148 "read"
149 ],
150 "collection": "usage_summaries",
151 "row_filter": {
152 "owner_id": "$user_id"
153 },
154 "reason": "the buckets a bill is computed from are readable by the person being billed; they are written by the rollup pass alone"
155 },
156 {
157 "effect": "allow",
158 "principal": "role:manager",
159 "actions": [
160 "execute"
161 ],
162 "object_id": "action_subscription_credit_unused",
163 "reason": "ending a subscription early with a pro-rata credit note for the unused days of a period billed in advance is staff's call (decision 4, 2026-11-30); the subscriber's own cancel runs to the period's end. The action also asks that the caller may update the subscription"
164 },
165 {
166 "effect": "allow",
167 "principal": "role:owner",
168 "actions": [
169 "execute"
170 ],
171 "object_id": "action_subscription_credit_unused",
172 "reason": "ending a subscription early with a pro-rata credit note for the unused days of a period billed in advance is staff's call (decision 4, 2026-11-30); the subscriber's own cancel runs to the period's end. The action also asks that the caller may update the subscription"
173 }
174 ],
175 "retracted": [
176 {
177 "effect": "allow",
178 "principal": "registered",
179 "actions": [
180 "create",
181 "read",
182 "update",
183 "delete"
184 ],
185 "collection": "subscriptions",
186 "row_filter": {
187 "owner_id": "$user_id"
188 },
189 "reason": "withdrawn in app-billing 0.10.0: the subscriber owns the row, and full update plus delete let them climb past_due/suspended -> active, swap to a cheaper plan, push the period end years out, or delete the agreement the biller walks. Replaced by read and a field-limited update; staff (role:manager) create and manage subscriptions"
190 }
191 ]
192}