Is there a way for the access control "read" function to allow access based on the value of a a related document?
Any idea for this as well? Same use-case, just for reading.
For this you could use a where query, yeah?
No, it seems like it does not resolve relations. So I can only compare the string saved in the db. But I'd like to check a field from the related document.
Can you share your query attempt?
// "subforums" collection
{
name: "public",
type: "checkbox"
}
// "post" collection
{
name: "subforum",
type: "relationship",
relationshipTo: "subforums"
}
// query constraint
return {
subforum: {
public: {
equals: true
}
}
Can you try “subform.public”: { equals: true }
Works! Thank you so much.
It's amazing that you guys provide such great support
does this sort of thing work for graphql queries too?
I think this distinction is worth being mentioned in the docs.
it does not, nested queries are not currently supported. But its on the roadmap:
https://github.com/payloadcms/payload/discussions/761I agree with ya there
Star
Discord
online
Get dedicated engineering support directly from the Payload team.