Back

Bucket create with wrong/too many Permissions

  • 0
  • Auth
  • Storage
  • Cloud
ThisIsStep2
14 May, 2024, 14:09

Hey ! I'm creating a bucket, that should have same id like my team.$id I would like this storage to have permissions - admins - can read and write all, rest of team members, can all create new document, each document will have own permissions as well.

when i do this:

TypeScript
    const newBucket = await storage.createBucket(partnerUniqueId, `BUCKET_${partnerData.name.replace(/ /g, "_")}`, [

      // All team members can write to this bucket
      Permission.write(Role.team(partnerUniqueId)),
      
      // All team admins can write and Read to this bucket
      Permission.write(Role.team(partnerUniqueId, "admin")),
      Permission.read(Role.team(partnerUniqueId, "admin")),
      
// all Admins can read from this bucket
      Permission.write(Role.label("admin")),
      Permission.read(Role.label("admin")),

    ], true);

I they all get automaticlly also UPDATE + DELETE permission, which i dont want to have. (like in the image attached)

How can i prevent this, no one of the team memebers should be able to update and delete.

TL;DR
Developers want to create a bucket with specific permissions but are seeing that the WRITE permission also includes UPDATE and DELETE. To prevent team members from having UPDATE and DELETE access, only grant WRITE permission without specifying UPDATE and DELETE. Write permission includes create, update, and delete by default. Update the code snippet to only include `Permission.write()` for the desired access level without specific mention of UPDATE and DELETE.
ThisIsStep2
14 May, 2024, 14:10

Bucket create with wrong/too many Permissions

Steven
14 May, 2024, 14:57

yes. write is an alias for create + update + delete

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