Enhance admin.hidden to support multi-tenant context: pass req and allow async #14264
antonioru
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey team,
In multi-tenant setups, when defining a
Collectiontheadmin.hiddenfunction only receives the{ user }argument, which makes it hard to drive visibility based on the active tenant or other request-scoped data.A common need is to show or enable a collection only when the user is operating within an allowed tenant.
Without access to the current request, we can’t reliably read the active tenant selection (for example from a multi-tenant plugin) or perform context-aware lookups.
I propose extending admin.hidden so it can optionally receive the req object and support returning a promise, while preserving backward compatibility with the existing synchronous signature.
This would let implementations base visibility on request-scoped tenant info, cookies/headers, or quick async checks, and continue working for simple user-only cases.
Current API:
Proposed (backward compatible):
Example: Hide a collection unless the user selects an active tenant:
Beta Was this translation helpful? Give feedback.
All reactions