|
| 1 | +--- |
| 2 | +'@objectstack/platform-objects': patch |
| 3 | +'@objectstack/plugin-auth': patch |
| 4 | +'@objectstack/plugin-security': patch |
| 5 | +'@objectstack/spec': patch |
| 6 | +'@objectstack/cli': patch |
| 7 | +--- |
| 8 | + |
| 9 | +feat(platform-objects): `sys_personal_view`, a reader's own named list views (server step of the first version) |
| 10 | + |
| 11 | +Clause-②: yes (widening) |
| 12 | +Metadata-protocol: none |
| 13 | + |
| 14 | +A reader can now keep named list views of their own, as user data rather than view metadata. The new platform object `sys_personal_view` holds one row per saved list: |
| 15 | + |
| 16 | +- its owner (`user_id`); |
| 17 | +- the object it lists (`object_name`); |
| 18 | +- the name the owner gave it (`label`); |
| 19 | +- the list configuration, in spec's `ListView` shape (`config`). |
| 20 | + |
| 21 | +It is registered beside `sys_user_preference`, on the same template, and the generic data API serves it at `/api/v1/data/sys_personal_view`. Which view opens by default is not stored here: the reader's existing per-object pin holds a view id, and a personal view's id is one more value it can hold. |
| 22 | + |
| 23 | +- **Owner only.** |
| 24 | + - The object declares the owner-only default row scope `user_id == current_user.id` for every operation. The table carries the organization column, so the organization wall bounds it too. |
| 25 | + - Another member gets nothing: no read by id (`404`), nothing listed, and no update (`404 RECORD_NOT_FOUND`). |
| 26 | + - A create naming another owner is refused `403 PERMISSION_DENIED`. |
| 27 | + - A view's owner is fixed when it is saved: an update that changes `user_id` is refused `403 PERMISSION_DENIED` for every caller but the system, platform administrators included. A save rule holds this, because for an organization member the `member_default` update floor (`created_by == current_user.id`) applies to an update in place of the object's own row scope. |
| 28 | +- **No back door for organization administrators.** `organization_admin`, and the derived `organization_admin_no_bypass`, name the object without the wildcard's super-user bits. An organization administrator reads, writes and deletes only their own views. |
| 29 | +- **Platform administrators are not limited.** The bare `admin_full_access` wildcard carries `viewAllRecords` and `modifyAllRecords`, so through the generic data API a platform administrator reads, edits and deletes any member's view. This is the same as `sys_user_preference` today. Whether that should change is an open question. |
| 30 | +- **The body is a `ListView` for the row's own object, judged on every save.** |
| 31 | + - A create, and an update that sends `config` or `object_name`, parse the resulting body with spec's `ListViewSchema`. |
| 32 | + - A body that does not parse is refused `400 VALIDATION_FAILED`, with one `fields[]` entry per issue, each path under `config`. |
| 33 | + - A body whose `data.object` names a different object than `object_name` is refused the same way, on `config.data.object`. |
| 34 | + - No new error code. |
| 35 | +- **Field security is not re-judged on save.** A view whose filter names a field the reader cannot read is still saved. The list query that applies the filter is refused `403 PERMISSION_DENIED` by the existing predicate guard. |
| 36 | +- **Not view metadata.** `/meta` never serves a personal view, the metadata write door never writes one, and a package export never carries one. Its id is the engine's record id, so it never takes the `object.key` view syntax. |
| 37 | +- **The owner's delete door.** `DELETE /api/v1/personal-views/:id` removes one personal view, and only the caller's own. |
| 38 | + - The row is read as the caller, so another member or an organization administrator gets the unknown-id `404 RECORD_NOT_FOUND`. |
| 39 | + - A row the caller can read but does not own is refused `403 PERMISSION_DENIED`. |
| 40 | + - Only then is the row removed, as the system, attributed to the caller and inside the caller's organization. Success is `200` with `{ id, deleted: true }`. |
| 41 | + - The door takes no query parameter (`400 VALIDATION_ERROR`) and serves signed-in callers only (`401 UNAUTHENTICATED`). |
| 42 | + - `AuthPlugin` mounts it on the kernel's HTTP server, in the shape of the comment-reaction unreact door. |
| 43 | +- **Grants.** |
| 44 | + - `member_default` grants read, create and edit on the object, and no delete. That set is bound to the `everyone` anchor, which carries no delete bit (ADR-0090 D5). |
| 45 | + - A member's generic data `DELETE` on a personal view is still refused `403 PERMISSION_DENIED`. The door above grants nothing. |
| 46 | + - External members (`external_default`) get no grant in this version. Whether they can save views is an open question for the Console half. |
| 47 | + |
| 48 | +`PLATFORM_OBJECTS_BY_PACKAGE['platform-objects']` (`@objectstack/spec/system`) now lists `sys_personal_view`, so lint and cross-reference checks know the name is real. The CLI's organization-ownership inventory carries the new object's row. |
0 commit comments