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 · 3.1 KB · 73 lines
| 1 | { |
| 2 | "retracted": [ |
| 3 | {"effect": "allow", "principal": "registered", "actions": ["read"], "collection": "thread_comments", "reason": "replaced by the published-or-own reads: without a row filter removed, flagged and pending comments were readable by anybody signed in (bug-reports/2026-11-28-06-14-40)"}, |
| 4 | {"effect": "allow", "principal": "registered", "actions": ["create", "read", "update", "delete"], "collection": "thread_comments", "row_filter": {"owner_id": "$user_id"}, "reason": "an earlier version's combined grant, since split into the write rule and the read rules this package ships"} |
| 5 | ], |
| 6 | "rules": [ |
| 7 | { |
| 8 | "effect": "allow", |
| 9 | "principal": "registered", |
| 10 | "actions": [ |
| 11 | "create", |
| 12 | "update", |
| 13 | "delete" |
| 14 | ], |
| 15 | "collection": "thread_comments", |
| 16 | "row_filter": { |
| 17 | "owner_id": "$user_id" |
| 18 | }, |
| 19 | "reason": "a signed-in user writes (and edits/removes) only comments they authored" |
| 20 | }, |
| 21 | { |
| 22 | "effect": "allow", |
| 23 | "principal": "registered", |
| 24 | "actions": [ |
| 25 | "read" |
| 26 | ], |
| 27 | "collection": "thread_comments", |
| 28 | "row_filter": { |
| 29 | "status": {"op": "in", "value": ["published", ""]} |
| 30 | }, |
| 31 | "reason": "signed-in users read PUBLISHED comments (a blank status is a comment from before moderation, which the schema defaults to published) on records they can reach -- the widget's fetch narrows to one (parent_collection,parent_id) thread; per-parent visibility inheritance is a follow-on (22-thread-spec). Moderation is enforced HERE, not in the widget: with no row filter every removed, flagged and pending body came back from the API to anybody signed in (bug-reports/2026-11-28-06-14-40)" |
| 32 | }, |
| 33 | { |
| 34 | "effect": "allow", |
| 35 | "principal": "registered", |
| 36 | "actions": [ |
| 37 | "read" |
| 38 | ], |
| 39 | "collection": "thread_comments", |
| 40 | "row_filter": { |
| 41 | "owner_id": "$user_id" |
| 42 | }, |
| 43 | "reason": "an author reads their own comments whatever a moderator did to them, so a removed comment is not silently gone from the one person it concerns" |
| 44 | }, |
| 45 | { |
| 46 | "effect": "allow", |
| 47 | "principal": "role:moderator", |
| 48 | "actions": [ |
| 49 | "read" |
| 50 | ], |
| 51 | "collection": "thread_comments", |
| 52 | "reason": "moderators read every comment, which is the only way to moderate one" |
| 53 | }, |
| 54 | { |
| 55 | "effect": "allow", |
| 56 | "principal": "role:moderator", |
| 57 | "actions": [ |
| 58 | "update" |
| 59 | ], |
| 60 | "collection": "thread_comments", |
| 61 | "reason": "moderators publish, flag and remove other people's comments by moving status; the schema's field permissions make every other field editable by the comment's author and admins only, so status is all this update can change, and status is read-only on a moderator's own comment. No delete: a moderated comment is removed by status, not erased" |
| 62 | }, |
| 63 | { |
| 64 | "effect": "allow", |
| 65 | "principal": "public", |
| 66 | "actions": [ |
| 67 | "execute" |
| 68 | ], |
| 69 | "object_id": "site_thread", |
| 70 | "reason": "the comment thread widget is a public static script (like site_list/site_detail); the thread_comments data it reads is still permission-gated per row" |
| 71 | } |
| 72 | ] |
| 73 | } |