Back
is it possible to make a document with permissions from Appwrite functions
- 0
- Databases
- Functions
- Flutter
TypeScript
databaseId: databaseId,
collectionId: collectionId,
documentId: userId,
data: {
'userId': userId,
'email': userEmail,
'createdAt': DateTime.now().toIso8601String(),
'lastLogin': DateTime.now().toIso8601String(),
'isActive': true,
},
permissions: [
Permission.read(
Role.user(userId)), // Only the user can read their document
Permission.update(
Role.user(userId)), // Only the user can update their document
Permission.delete(
Role.user(userId)), // Only the user can delete their document
],
);
when i add the permissions in the functions i get an error AppwriteException: user_unauthorized, Permissions must be one of: (any, guests) (401 but when i remove it works fine ,i have selected all 10 of the Scopes for database.
TL;DR
Developers are trying to create a document with permissions using Appwrite functions, but are facing an `AppwriteException: user_unauthorized` error when setting permissions. The error is due to incorrect permissions being set up in the function, as permissions must be limited to `(any, guests)`. Removing the permissions resolves the issue.How are you setting up your appwrite client?
Recommended threads
- Unable to create Sites or Functions with...
Heya, I was looking at the appwrite documentation for Sites API with the server api: https://appwrite.io/docs/references/cloud/server-nodejs/sites I can’t fin...
- listRows result parsing issue
I'm using Appwrite Dart SDK "24.2.0". When I perform a listRows call in dart, I have this reponse in JSON: in " Future<models.RowList> listRows()" { "total" :...
- Index for combination of columns
How am i suppposed to apply index so that combination of two columns alwasy remain unique in appwrite table though console