Ability to override defaultPayloadAccess
#4694
maxsynnott
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.
-
In the Access Control documentation it mentions a
defaultPayloadAccess
function which is defined like so:I think it would be useful to be able to override this function. For example in my application I have added a
role
field to myusers
collection which can be either'user' | 'admin'
. I want to change thedefaultPayloadAccess
function to something like so:Without this I have to manually add this function to every single access route and if I accidentally miss one or forget to add them when creating a new collection I open access to all users which is obviously a vulnerability.
Ideally, you could also change the default function depending on the action like so:
I'd be happy to assist with implementation if this is deemed wanted
Beta Was this translation helpful? Give feedback.
All reactions