Multitenancy file uploads

Hi,

I have been following your ‘Can You Build a Multi-Tenant CMS in 1 Hour?’ video https://www.youtube.com/watch?v=AgqyTQqY90E which has been great but now I’m starting to build out some sites I’ve discovered that file uploads will be problem. For example, Site A users shouldn’t be able to see Site B’s uploads and vice versa. What is the most straight forward way to accomplish this? I’m assuming I’ll need to set up some flows which will run whenever files are uploaded to move them to the specific site folder and restrict user access so that only users with the correct permission can access them. Just not sure how to do this :thinking:

1 Like

You can add custom fields to Directus tables, including files. What I’d try in this case is to setup a tenant column on directus_files, and then configuring the read/write permissions for directus_files to only allow access to files where tenant matches the tenant of the current user :slight_smile: