Back

How to get only the files a User Created from Bucket of all Users files?

  • 0
  • Tools
  • Apple
LosDragon
21 Aug, 2024, 19:27

Is this the right approach to begin with? I want to store all of my users Audio Files in a Shared Bucket. Does this make sense, or should I create a bucket for each of my users individually?

I see with file security by default the user that created the file has permission to READ, UPDATE, DELETE. Now How can I fetch all of the documents a user has permission to access?

TL;DR
- Create collections to track who uploaded which files - No current way to track who created a file - Users can only access files they have permission for - Consider the approach depending on your needs: shared bucket vs individual buckets - No built-in way to fetch all documents a user has access to
ideclon
21 Aug, 2024, 19:51

If a user tries to request all the files in the Bucket, only the ones it has access to will be returned. If you want to get it from somewhere else, I don’t believe there’s currently any way, but I believe I’ve seen some recent discussion about implementing a way to get a list of things (presumably whether Database Documents or Storage Files) based on it’s Permissions.

ideclon
21 Aug, 2024, 19:55

As for who created a file, to my knowledge, there’s currently no way to find that

ideclon
21 Aug, 2024, 19:56

The best option would be to have a Collection and keep track of who uploaded what there, but you’d have to update that separately on upload

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more