Here's a bare minimum reproduction repo:
https://github.com/HanielU/payload-access-control-issueI've provided screenshots for both My config and errors I'm getting after logging in as a customer
I really have no Idea what I'm doing wrong here...
The logic is basically: Only customers who are in the
recipients
field of a Notification can view that notification
Without testing this, I
thinkthis should work:
return {
or: [
{
and: [
{
'recipient.value': {
equals: user.id,
},
},
{
'recipient.collection': {
equals: 'users',
},
},
]
},
{
and: [
{
'recipient.value': {
equals: user.id,
},
},
{
'recipient.collection': {
equals: 'customers',
},
},
]
}
]
}
Still gives the same error
Hey @haniel.u try changing your access control to
return {
or: [
{
'recipient.value': {
equals: user.id
}
},
],
};
Does that help? Keep the above returns for true/false like you did, but replace line 10 and beyond with this ^
Alright let me try
This works, thank you so much 🥹
You're welcome!
Star
Discord
online
Get dedicated engineering support directly from the Payload team..