Getting list of users who can access an individual collection item based on permissions

I’m trying to create an access list of a certain collection item so that as an Admin, I can see which users are able to access it based on the permissions set on it. I created a m2m field in the collection with directus_users but realised that there is no info on retrieving the list of users who can access a certain item in the collection by id. In the policies page, there is a users field which shows which users have been attached to the policy but I am looking for a way to reverse search in the item so that I can get a list of users who can access it based on the permissions. Is this possible within Directus or can it be done using SQL queries? Thanks in advance.

1 Answer

1

I’ve just figured this out for myself in a multi tenant project where I need an organisation’s admin to be able to manage a list of staff who have access to certain items in another collection.

You need to create a o2m field which lists the related items in the join table. The rest is down to access policies.