Distinguishing Dashboard Panel and External API Requests #2671
Replies: 4 comments 2 replies
-
I came here to make this very request! Great idea, for now I'll be using |
Beta Was this translation helpful? Give feedback.
-
Bumping this, we're still getting the occasional infinite loop that brings down admin. This seems like a really simple (yet important) fix, any chance we can add this to the roadmap? |
Beta Was this translation helpful? Give feedback.
-
This would be great! For example, I have a collection of
This works well, but if I'm editing the Store from the dashboard, the default is loaded. This presents two problems:
Preventing the afterRead hook from running if the request is coming from the dashboard would fix both issues for me. |
Beta Was this translation helpful? Give feedback.
-
I think |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone 👋
I would like to propose a simple DX enhancement that would greatly improve access control and hooks capabilities.
Currently, I don't see any way to distinguish, in an easy and straightforward way, if a request is coming from a public request or from the Dashboard, we assume it using the origin headers, which are notoriously unreliable (eg: proxies in front not forwarding). There is the
req.payloadAPI
but always returnsREST
from dashbaord or public API calls. I've searched the codebase for something like this but didn't find it.Upon investigation, I noticed that list views append an
invoke
UUID to the query string, which could be leveraged to derive the necessary information. Unfortunately, this UUID is not appended to other REST requests.To address this limitation, I suggest making improvements to the src/admin/api.ts file. We could include this information a cookie/header/queryString/whatever. We could then utilize this additional parameter in a middleware function to set a flag, such as isDashboardRequest (or any other appropriate name). This flag could be made available throughout the hooks and access mechanisms, enabling advanced filtering capabilities.
I would love to hear your thoughts on this proposed enhancement.
Beta Was this translation helpful? Give feedback.
All reactions