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 · 1.9 KB · 57 lines
| 1 | { |
| 2 | "rules": [ |
| 3 | { |
| 4 | "effect": "allow", |
| 5 | "principal": "registered", |
| 6 | "actions": [ |
| 7 | "create", |
| 8 | "read", |
| 9 | "update", |
| 10 | "delete" |
| 11 | ], |
| 12 | "collection": "time_logs", |
| 13 | "row_filter": { |
| 14 | "owner_id": "$user_id" |
| 15 | }, |
| 16 | "reason": "signed-in users manage their own time logs" |
| 17 | }, |
| 18 | { |
| 19 | "effect": "allow", |
| 20 | "principal": "public", |
| 21 | "actions": [ |
| 22 | "execute" |
| 23 | ], |
| 24 | "object_id": "site_timer_actions", |
| 25 | "reason": "the timer start/stop/running routes are public execute, same convention as every other site object (app-theme's site_style, app-catalog's site_stock); the object itself requires a signed-in identity and scopes every read/write to $user_id before touching time_logs, same as the row-filtered collection API would" |
| 26 | }, |
| 27 | { |
| 28 | "effect": "allow", |
| 29 | "principal": "role:manager", |
| 30 | "actions": [ |
| 31 | "read", |
| 32 | "update" |
| 33 | ], |
| 34 | "collection": "time_logs", |
| 35 | "reason": "approving time means reading and moving somebody else's entry, which the owner-filtered rule above deliberately cannot do. The hook still refuses self-approval, so a manager approving their OWN hours is blocked by the gate rather than by this grant -- the rule says who may act on other people's time, not who may bless their own." |
| 36 | }, |
| 37 | { |
| 38 | "effect": "allow", |
| 39 | "principal": "registered", |
| 40 | "actions": [ |
| 41 | "read" |
| 42 | ], |
| 43 | "collection": "rate_cards", |
| 44 | "reason": "anyone logging time should be able to see the rate their hours will be billed at; a rate you cannot look up is one you cannot check an invoice against" |
| 45 | }, |
| 46 | { |
| 47 | "effect": "allow", |
| 48 | "principal": "role:manager", |
| 49 | "actions": [ |
| 50 | "create", |
| 51 | "update" |
| 52 | ], |
| 53 | "collection": "rate_cards", |
| 54 | "reason": "writing a rate card is setting a price, not recording work" |
| 55 | } |
| 56 | ] |
| 57 | } |