Hi,
I am seeking help to resolve an access control issue in a Directus collection involving a many-to-many relationship.
I have a mobile_studies (MS) collection with two fields:
-
Tasks – a many-to-many (M2M) relationship with MS.
-
Participants – a one-to-many (O2M) relationship with MS, pointing to
directus_users.
I want to display all tasks associated with an MS where the CURRENT_USER is a participant, specifically when I open the Tasks collection in the Directus UI.
I have tried several approaches, including using the junction collection, but the junction only allows me to set task fields in MS and does not let me filter tasks directly in the Tasks collection.
I also attempted the following filter(and some others as well):
{
“mobile_studies_tasks_1”: {
"\_some": {
"mobile_studies_id": {
"participants": {
"\_some": {
"id": {
"\_eq": "$CURRENT_USER"
}
}
}
}
}
}
}
However, none of them worked; all tasks still appear in the Tasks collection.
Could you please advise on how to properly configure access control so that only tasks from studies where the current user is a participant are shown in the Tasks collection?
Thank you for your help.