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.6 KB · 78 lines
| 1 | { |
| 2 | "rules": [ |
| 3 | { |
| 4 | "effect": "allow", |
| 5 | "principal": "public", |
| 6 | "actions": ["read"], |
| 7 | "collection": "profiles", |
| 8 | "reason": "public creator profiles are readable by anyone, no row_filter needed since every profile is visible -- same posture as app-forum's boards" |
| 9 | }, |
| 10 | { |
| 11 | "effect": "allow", |
| 12 | "principal": "public", |
| 13 | "actions": ["read"], |
| 14 | "collection": "follows", |
| 15 | "reason": "the follow graph is public, matching the source's public follower/following counts and lists on a profile page" |
| 16 | }, |
| 17 | { |
| 18 | "effect": "allow", |
| 19 | "principal": "public", |
| 20 | "actions": ["read"], |
| 21 | "collection": "profile_comments", |
| 22 | "row_filter": {"status": "approved"}, |
| 23 | "reason": "only approved guestbook comments are publicly visible, matching the source's moderation posture -- pending and rejected comments are invisible to anonymous and non-owner readers" |
| 24 | }, |
| 25 | { |
| 26 | "effect": "allow", |
| 27 | "principal": "registered", |
| 28 | "actions": ["create", "read", "update", "delete"], |
| 29 | "collection": "profiles", |
| 30 | "row_filter": {"owner_id": "$user_id"}, |
| 31 | "reason": "a signed-in user manages their own profile; id == the user's own id, one profile per user" |
| 32 | }, |
| 33 | { |
| 34 | "effect": "allow", |
| 35 | "principal": "registered", |
| 36 | "actions": ["create", "read", "update", "delete"], |
| 37 | "collection": "follows", |
| 38 | "row_filter": {"owner_id": "$user_id"}, |
| 39 | "reason": "a signed-in user manages the follow edges they created (owner_id == follower_id): follow is create, unfollow is delete. The account being followed has no special access to someone else's edge" |
| 40 | }, |
| 41 | { |
| 42 | "effect": "allow", |
| 43 | "principal": "registered", |
| 44 | "actions": ["create", "read", "update", "delete"], |
| 45 | "collection": "profile_comments", |
| 46 | "row_filter": {"owner_id": "$user_id"}, |
| 47 | "reason": "v1 guestbook posting is signed-in only (see schemas/profile_comments.json and dbbasic-package.json for the deferred anonymous path); a commenter writes, edits and deletes their own comment and reads it in any state, but cannot move its status (the schema makes status read-only to its author): moderators do that, under the role:moderator rules below. The PROFILE owner has no say over comments on their profile" |
| 48 | }, |
| 49 | { |
| 50 | "effect": "allow", |
| 51 | "principal": "role:moderator", |
| 52 | "actions": ["read"], |
| 53 | "collection": "profile_comments", |
| 54 | "reason": "moderators read every guestbook comment, pending and rejected included: the pending ones are the queue they work" |
| 55 | }, |
| 56 | { |
| 57 | "effect": "allow", |
| 58 | "principal": "role:moderator", |
| 59 | "actions": ["update"], |
| 60 | "collection": "profile_comments", |
| 61 | "reason": "moderators approve and reject other people's guestbook 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 rejected, not erased" |
| 62 | }, |
| 63 | { |
| 64 | "effect": "allow", |
| 65 | "principal": "public", |
| 66 | "actions": ["execute"], |
| 67 | "object_id": "site_profile", |
| 68 | "reason": "public profile pages are public; visitors see the profile, its approved guestbook comments, and a sign-in prompt instead of the follow button and comment form" |
| 69 | }, |
| 70 | { |
| 71 | "effect": "allow", |
| 72 | "principal": "public", |
| 73 | "actions": ["execute"], |
| 74 | "object_id": "site_profile_edit", |
| 75 | "reason": "the edit page itself is publicly reachable; it shows a sign-in prompt to anonymous visitors and the owner-only form to a signed-in user, same posture as app-invoices' site_invoices" |
| 76 | } |
| 77 | ] |
| 78 | } |