Skip to content

Limit menu items, pages and widgets to groups #3444

Todo

Description

@rubenvdlinde

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

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"]
Loading
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 in appinfo/info.xml is 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

Describe alternatives you've considered

Questions for maintainers

  1. 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.
  2. 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.
  3. 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
Relevant files:
Related issues

Drafted with AI assistance from the project plan; @rjzondervan reviews it. Part of #3419.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions