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 · 11.1 KB · 191 lines
1{
2 "retracted": [
3 {
4 "effect": "allow",
5 "principal": "registered",
6 "actions": [
7 "create",
8 "read",
9 "update",
10 "delete"
11 ],
12 "collection": "payments",
13 "row_filter": {
14 "owner_id": "$user_id"
15 },
16 "reason": "signed-in users manage payments they recorded"
17 },
18 {
19 "effect": "allow",
20 "principal": "registered",
21 "actions": [
22 "create",
23 "read",
24 "update",
25 "delete"
26 ],
27 "collection": "refunds",
28 "row_filter": {
29 "owner_id": "$user_id"
30 },
31 "reason": "signed-in users manage refunds they recorded"
32 },
33 {
34 "effect": "allow",
35 "principal": "public",
36 "actions": [
37 "execute"
38 ],
39 "object_id": "site_payments",
40 "reason": "the bespoke /payments page was deleted in 0.6.0 (the index is a seeded view through site_view_render, which carries its own public grant); no package ships this object, so the grant would make whatever is later created under the id runnable"
41 },
42 {
43 "effect": "allow",
44 "principal": "registered",
45 "actions": [
46 "create",
47 "read",
48 "update"
49 ],
50 "collection": "refunds",
51 "row_filter": {
52 "owner_id": "$user_id"
53 },
54 "reason": "withdrawn in app-payments 0.7.0: it let the customer who owns a payment (checkout and the Stripe webhook record payments owned by the payer) POST a refund of it, which the books then journalled -- money out, decided by the person receiving it. Replaced by an owner-filtered read; refunds are created by role:manager"
55 },
56 {
57 "effect": "deny",
58 "principal": "owner_fallback",
59 "actions": [
60 "delete"
61 ],
62 "collection": "refunds",
63 "reason": "replaced in app-payments 0.7.0 by the same opt-out covering update as well"
64 },
65 {
66 "effect": "allow",
67 "principal": "registered",
68 "actions": [
69 "create",
70 "read",
71 "update"
72 ],
73 "collection": "payments",
74 "row_filter": {
75 "owner_id": "$user_id"
76 },
77 "reason": "withdrawn in app-payments 0.8.0: an invoice raised by checkout or the subscription biller is owned by the customer it bills, and relation.requires: update on payments.invoice_id passes for that owner -- so the customer recorded a 'received' cash payment against their own invoice (201), system_invoice_status flipped it to paid, and app-shop's fulfillment shipped. Replaced by an owner-filtered read; payments are recorded by role:manager"
78 },
79 {
80 "effect": "deny",
81 "principal": "owner_fallback",
82 "actions": [
83 "delete"
84 ],
85 "collection": "payments",
86 "reason": "replaced in app-payments 0.8.0 by the same opt-out covering update as well"
87 },
88 {
89 "effect": "allow",
90 "principal": "role:manager",
91 "actions": [
92 "read",
93 "update"
94 ],
95 "collection": "payments",
96 "reason": "replaced in app-payments 0.8.0 by the same grant with create"
97 }
98 ],
99 "rules": [
100 {
101 "effect": "allow",
102 "principal": "registered",
103 "actions": [
104 "read"
105 ],
106 "collection": "payments",
107 "row_filter": {
108 "owner_id": "$user_id"
109 },
110 "reason": "a customer reads the payments recorded under them. READ ONLY since 0.8.0: the customer owns the invoice a checkout or the subscription biller raises, so a create grant here let them record a payment against their own bill and have it marked paid (and shipped) with no money having moved. Money arrives through the Stripe webhook and checkout (in process) or is recorded by staff"
111 },
112 {
113 "effect": "allow",
114 "principal": "registered",
115 "actions": [
116 "read"
117 ],
118 "collection": "refunds",
119 "row_filter": {
120 "owner_id": "$user_id"
121 },
122 "reason": "a customer reads the refunds made to them. READ ONLY since 0.7.0: a payment is owned by whoever paid it (checkout, the Stripe webhook), so a create grant here let the payer refund themselves and have the books journal it. A customer who wants money back asks through a return (app-returns) or a dispute (app-disputes), and a member of staff decides"
123 },
124 {
125 "effect": "allow",
126 "principal": "role:manager",
127 "actions": [
128 "create",
129 "read",
130 "update"
131 ],
132 "collection": "payments",
133 "reason": "staff record the money that arrives outside the card processor (cash, cheque, bank transfer), read every payment and work them -- bounce one, annotate it; hook_payments lets nobody but an admin change what a payment records, and its locked check caps every payment at the invoice's open balance. Update is also what refunds.payment_id's relation.requires asks of a refund's writer. No delete: money moves, it does not mutate"
134 },
135 {
136 "effect": "allow",
137 "principal": "role:manager",
138 "actions": [
139 "create",
140 "read",
141 "update"
142 ],
143 "collection": "refunds",
144 "reason": "refunds are staff work: the role that already issues and corrects invoices (app-invoices) sends money back. hook_refunds still caps every refund at what the payment can give back and lets nobody but an admin change more than the reason; no delete (a deleted refund reopens its headroom)"
145 },
146 {
147 "effect": "allow",
148 "principal": "public",
149 "actions": [
150 "execute"
151 ],
152 "object_id": "webhook_stripe",
153 "reason": "Stripe is not a user of this server and cannot hold a credential: authenticity comes from the HMAC signature the object verifies over the raw body, which is why the endpoint must be publicly reachable and the object must fail closed"
154 },
155 {
156 "effect": "allow",
157 "principal": "public",
158 "actions": [
159 "execute"
160 ],
161 "object_id": "action_stripe_checkout",
162 "reason": "the payer has no account here; possession of the unguessable portal token IS the authorization, same as viewing the invoice, and the amount is computed server-side from the open balance"
163 },
164 {
165 "effect": "deny",
166 "principal": "owner_fallback",
167 "actions": [
168 "update",
169 "delete"
170 ],
171 "collection": "payments",
172 "reason": "a recorded payment is neither edited nor deleted by the person it names as owner, who is usually the customer who paid: money moves, it does not mutate. Record a refund, or have staff mark it bounced. No rule grants a registered user update or delete; this switches the engine's owner fallback off for both. The manager grant still grants update; admins and in-process writers are unaffected"
173 },
174 {
175 "effect": "deny",
176 "principal": "owner_fallback",
177 "actions": [
178 "update",
179 "delete"
180 ],
181 "collection": "refunds",
182 "reason": "a recorded refund is neither edited nor deleted by the person it names as owner, who is usually the customer it paid: deleting one reopens its headroom, and correcting one is staff's (the manager grant above) or an admin's. No rule grants a registered user update or delete; this switches the engine's owner fallback off for both. Admins and in-process writers are unaffected"
183 },
184 {"effect": "allow", "principal": "role:cashier", "actions": ["read"], "collection": "payments", "reason": "staff read the shop's payments and refunds (role:manager already records them) whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"},
185 {"effect": "allow", "principal": "role:shift_lead", "actions": ["read"], "collection": "payments", "reason": "staff read the shop's payments and refunds (role:manager already records them) whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"},
186 {"effect": "allow", "principal": "role:owner", "actions": ["read"], "collection": "payments", "reason": "staff read the shop's payments and refunds (role:manager already records them) whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"},
187 {"effect": "allow", "principal": "role:cashier", "actions": ["read"], "collection": "refunds", "reason": "staff read the shop's payments and refunds (role:manager already records them) whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"},
188 {"effect": "allow", "principal": "role:shift_lead", "actions": ["read"], "collection": "refunds", "reason": "staff read the shop's payments and refunds (role:manager already records them) whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"},
189 {"effect": "allow", "principal": "role:owner", "actions": ["read"], "collection": "refunds", "reason": "staff read the shop's payments and refunds (role:manager already records them) whoever owns the row. Checkout files a guest sale under the shop's account (shop.owner_id) and a signed-in customer's under that customer, so the owner-scoped grant showed a cashier or a manager none of them, and the Corner Cup simulation's staff signed in as the owner to do their jobs, which attributes every act to one login. Read only: changes go through app-counter's actions (void, hand over, corrections), which keep an order and its invoice in step and record who did it and why"}
190 ]
191}