Back

Problems with using permissions in Flutter

  • 0
  • Databases
  • Flutter
  • Cloud
Seroga88i
15 Jul, 2024, 20:40

Hello guys, I create documents and provide an array of permissions but when another user logs in and loads the data the second user can load the data from the first user. I use following code:

TypeScript
final response = await databases.createDocument(
  databaseId: databaseId,
  collectionId: collectionId,
  documentId: ID.unique(),
  data: data.toMap(),
  permissions: [
    Permission.read(Role.user(user.$id)),
    Permission.write(Role.user(user.$id)),
    Permission.update(Role.user(user.$id)),
    Permission.delete(Role.user(user.$id)),
  ],
);

In the web console i can see that the document has the right flag with user:<userId> Still do not understand why the second user can see the data. Do you have an idea what I am missing? Kind regards

TL;DR
Issue: Permissions set for documents in Flutter not working correctly, allowing second user to access data intended for first user. Solution: Check permissions implementation in the backend to ensure that only the specified user has access to the document. Additionally, verify that the permissions are correctly assigned and enforced.
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