Repository navigation
Todo
Labels
enhancementNew feature or request
Description
Is your feature request related to a problem? Please describe.
- One application often serves several roles. Today every member sees everything in it.
Why this is needed
- One application often serves several roles, such as the intake desk, the case worker and the manager. Today every member sees every menu item, page and widget, so a role's screen cannot be kept clean.
- buildiq parity: buildiq hides menu items, pages and widgets by group and filters them on the server; Tables has ownership and shares only (section 4 of the feature comparison, "Visibility gating", partial).
- It builds on the menu of feat(contexts): give applications a menu with its own API #3135. The visibility rules editor (Editor for visibility rules on menu items, pages and widgets #3453) edits these fields ("settings and permission fields (sprint 4) before the designer editors (sprint 5)"), the manifest export (Export an application as a manifest on api/2 #3450) carries them, and acceptance path 6 tests them.
Describe the solution you'd like
- Menu items, pages and widgets get an optional list of groups. A user outside those groups does not see them. The filtering happens on the server when the application is served, not only in the interface.
Diagram
flowchart LR
U["User opens the application"] --> A["GET api/2/contexts/{contextId}"]
A --> F{"Per menu item, page and widget:<br/>no groups, or user in one?"}
F -- yes --> K["Kept in the response"]
F -- no --> X["Left out"]
U --> P["Opens a hidden page by its address"]
P --> N["404"]
K --> D["Data still checked by<br/>table and view permissions"]
Acceptance Criteria
- An optional groups field on menu items, pages and widgets, empty meaning everyone.
- The menu, page and widget responses leave out what the user may not see.
- Opening a hidden page directly answers 404.
- The groups do not grant access to data; table and view permissions still apply.
- Unit tests, and acceptance path 6.
- Writing the groups field: 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. The filter on serving uses the user's own groups from the server, never a group or flag from the request. - The groups are stored as a JSON list in a new text column on menu items, pages and widgets (never the database JSON column type, as agreed on Grid pages in applications (frontend) #3099), filtered in PHP after the application is loaded.
- Migration: nullable columns, where NULL means everyone, so no backfill; 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). - When a group is deleted, its id is removed from every list in the same transaction. A repair step that runs once after the upgrade removes leftovers, not a recurring cleanup job (as agreed on Grid pages in applications (data model and API) #3100), for groups deleted while the listener was not there.
Out of scope
- The editor for these fields: Editor for visibility rules on menu items, pages and widgets #3453.
- Rules on other conditions than groups (buildiq's
visibleIf), and access to data, which stays with shares on tables and views. - Proposed slicing, one PR per entity in landing order: menu items (after feat(contexts): give applications a menu with its own API #3135), pages, widgets.
Describe alternatives you've considered
Questions for maintainers
- Storage: a JSON list in a text column on each item, or a join table of item and group? We would go with the text column, because items are filtered in PHP after one application is loaded and never queried by group.
- A user outside the groups of the application's first page: open the next page they can see, or answer 404? We would go with the next visible page, so the application still opens.
- Do managers of the application see everything, marked as limited, so they can edit it? We would go with yes, because otherwise a manager can hide a page from themselves.
Additional context
Linking to other objects
- The issue touches menu items, pages and widgets: each gets a groups field.
- Today: pages have slugs (Technical name for tables and applications, CRUD routes by application and table #3094) but no reference URL, so a page cannot be linked or previewed elsewhere.
- What this issue must do: when pages get a reference URL later, the reference provider applies the same group filter, so a link to a hidden page shows no content. The groups do not decide which links of a row a user sees; Link a row to objects in other apps: mails, Deck cards, files, rows of other tables #3468 checks access per end on the row and the target. Store group ids and carry them through the manifest export.
Relevant files:
Related issues
- feat(contexts): give applications a menu with its own API #3135
- 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