Repository navigation
Todo
Labels
enhancementNew feature or request
Description
Is your feature request related to a problem? Please describe.
- An application often needs a few values of its own, such as a default view or a contact address, and users want to keep their own choices, such as a collapsed menu.
Why this is needed
- The managers of an application need a few values of its own, such as a default view or a contact address, and its users want their own choices kept, such as a collapsed menu. Today Tables has its own settings and a config per table and view (
api/2/config), but an application has none. - buildiq parity:
adminSettings, settings pages andpersonalisationin the manifest, backed by OpenRegister's/api/settingsand/api/preferences/{key}(sections 1 and 7 of the feature comparison). - The settings page type (Settings page type of an application #3449) builds its form from this schema, and the manifest export (Export an application as a manifest on api/2 #3450) carries the settings. The plan puts "settings and permission fields (sprint 4) before the designer editors (sprint 5)".
Describe the solution you'd like
api/2endpoints for settings of an application, set by its managers, and preferences per user per application.
Diagram
sequenceDiagram
actor M as Manager
actor U as Member
participant API as New application settings API
participant S as New settings service
participant DB as Database
M->>API: PUT settings of the application
API->>S: is the user a manager of the application?
S->>S: validate against the declared schema
S->>DB: store per application
U->>API: GET settings
API->>S: is the user a member?
S-->>U: values, read only
U->>API: PUT own preference
API->>S: can the user open the application?
S->>DB: store per user per application
Acceptance Criteria
- Settings: read by every member, written by managers only.
- Preferences: read and written by the user only, for applications they can open.
- Values are validated against a schema declared per application.
- Export and import carry the settings, not the preferences.
- Unit tests for the permissions.
- Writing settings: the route declares its permission with
#[RequirePermission](manage on the application) using a fixed node type (context), and the service checks the same right before it writes (as agreed on UUIDs for rows #3093 and in the review of feat(contexts): give applications a menu with its own API #3135). A test runs every write as a reader and expects 403, or 404 where the reader may not know the object exists. Writing a preference needs read on the application, checked the same way. - Values are stored as JSON in a text column, one record per application, never in the database JSON column type (as agreed on Grid pages in applications (frontend) #3099). The declared schema is stored the same way.
- Migration: a new table with a unique index on the application id; no empty-string defaults, since Oracle stores
''as NULL (as raised on Technical name for tables and applications, CRUD routes by application and table #3094); the version inappinfo/info.xmlis bumped with the migration (as raised on feat(rows): add persistent UUIDv7 identifiers to rows #3229). - Deleting an application deletes its settings and its users' preferences in the same transaction. Deleting a user removes their preferences.
Out of scope
- The settings page: Settings page type of an application #3449.
- Tables' own settings and the existing config per table and view (
api/2/config). - Proposed slicing, one PR each in landing order: settings with their schema, then preferences.
Describe alternatives you've considered
Questions for maintainers
- Where the schema of an application's settings lives: a JSON Schema stored with the application and edited in the designer, or a fixed list of setting kinds? We would go with a JSON Schema, because the manifest export carries it and the settings page builds its form from it.
- Preferences: the server's user preferences (app
tables, one key per application), or a table of our own? We would go with the server's user preferences, because user deletion and the user migrator already handle them, so only settings need a new table.
Additional context
Linking to other objects
- The issue touches the application (context in code): settings per application and preferences per user.
- Today: reference providers render tables and views; an application has no reference URL. Pages, tables and views have slugs (
page_<id>,table_<id>,view_<id>, Technical name for tables and applications, CRUD routes by application and table #3094). - What this issue must do: a setting that points at a table or page stores its slug (a view its existing technical name), not the database id, so it survives export and import. A setting that points at an object in another app (a Deck board, a mailbox) uses the type and id names of Link a row to objects in other apps: mails, Deck cards, files, rows of other tables #3468, not a URL. Preferences are not exported and are removed when the user is deleted.
Relevant files:
Related issues
- Grid pages in applications (data model and API) #3100
- Technical name for tables and applications, CRUD routes by application and table #3094
- links between rows and other apps (Link a row to objects in other apps: mails, Deck cards, files, rows of other tables #3468)
Drafted with AI assistance from the project plan; @rjzondervan reviews it. Part of #3419.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity