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.
dron-policy.schema.json · 4.2 KB · 67 lines
| 1 | { |
| 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 3 | "title": "DRON deployment policy", |
| 4 | "description": "DRON (Data Rules Object Notation) is a portable, declarative description of an application's data and the rules over it. This file validates a deployment's own permission policy: the one document a box keeps at data/permissions/policy.json (and that PUT /permissions/policy replaces), made of how open the box is by default, who holds which role, and every rule installed packages and the operator have added. A save is held to it: PUT /permissions/policy refuses, before writing, a policy with a mistake this file refuses that changes meaning (an unknown key, effect, action, principal, operator or $-variable, a coerced value, an unparseable date), except in rules the stored policy already holds. Reading is not: a box reads its own stored file more leniently than this (an unknown key is ignored, a rule key spelt wrong is dropped) so that it never stops serving or changes a decision over its own file, and reports each such mistake instead. The rule definition here is the one packages are held to at install (dron-permissions.schema.json). DRON 0.2.", |
| 5 | "type": "object", |
| 6 | "additionalProperties": false, |
| 7 | "properties": { |
| 8 | "$schema": { |
| 9 | "description": "Optional pointer to this file so an editor can offer completion and flag mistakes. The engine ignores it.", |
| 10 | "type": "string" |
| 11 | }, |
| 12 | "access_mode": { |
| 13 | "description": "How open the box is before any rule is read. role_based (the default, and what to write): nothing is allowed unless a rule or the owner fallback allows it. private: only the owner of a row reaches it. registered: any signed-in user may read. public: anyone may read, nobody may write. subscription: a user with a subscription may read. password: a password gate in front must authenticate first. Rules are read after the mode in every case, and an explicit deny beats all of them. Example: \"role_based\".", |
| 14 | "enum": [ |
| 15 | "role_based", |
| 16 | "private", |
| 17 | "registered", |
| 18 | "public", |
| 19 | "subscription", |
| 20 | "password" |
| 21 | ] |
| 22 | }, |
| 23 | "roles": { |
| 24 | "description": "The roles this box knows, by name, each with display metadata an admin screen shows. A role grants nothing by being listed: what a role may do is what the rules give role:<name>. Keys of the metadata are free; the starter policy uses label (text), optional (true if a shop may leave the role unused) and description (a sentence). Example: {\"manager\": {\"label\": \"Manager\", \"optional\": false, \"description\": \"Staff.\"}}.", |
| 25 | "type": "object", |
| 26 | "propertyNames": { |
| 27 | "minLength": 1 |
| 28 | }, |
| 29 | "additionalProperties": { |
| 30 | "description": "One role's display metadata.", |
| 31 | "type": "object" |
| 32 | } |
| 33 | }, |
| 34 | "user_roles": { |
| 35 | "description": "Which roles each user holds: user id to a list of role names. A user holds the roles listed here plus any their sign-in carries. Example: {\"u_1042\": [\"manager\", \"cashier\"]}.", |
| 36 | "type": "object", |
| 37 | "propertyNames": { |
| 38 | "minLength": 1 |
| 39 | }, |
| 40 | "additionalProperties": { |
| 41 | "description": "The role names this user holds, each at most once.", |
| 42 | "type": "array", |
| 43 | "uniqueItems": true, |
| 44 | "items": { |
| 45 | "type": "string", |
| 46 | "minLength": 1 |
| 47 | } |
| 48 | } |
| 49 | }, |
| 50 | "admin_roles": { |
| 51 | "description": "Role names whose holders bypass every rule, deny rules included. Leaving the key out means [\"admin\", \"superuser\"]; an empty list means nobody bypasses. Keep it short: a holder of one of these roles can do everything. Example: [\"admin\", \"superuser\"].", |
| 52 | "type": "array", |
| 53 | "uniqueItems": true, |
| 54 | "items": { |
| 55 | "type": "string", |
| 56 | "minLength": 1 |
| 57 | } |
| 58 | }, |
| 59 | "rules": { |
| 60 | "description": "Every allow and deny, in order. Explicit denies are checked before allows; the first matching allow decides. Packages add their own on install, tagged with their id (the package key); the operator's rules carry none. Each is the DRON permission rule, described in dron-permissions.schema.json.", |
| 61 | "type": "array", |
| 62 | "items": { |
| 63 | "$ref": "dron-permissions.schema.json#/$defs/rule" |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | } |