Hi there, I want a user to update a Document he has read, update and delete permissions to. Now until he is the only one having any permissions this call works fine:
Document result = await databases!.updateDocument(
databaseId: AppConstants.privateEventsDatabaseId,
collectionId: AppConstants.eventsCollectionId,
documentId: event.id!,
data: event.toJson(),
permissions: event.appwritePermissions,
);
The method event.appwritePermissions creates a List<String> looking like this:
permissions = [
"read("user:648ade3b69d58f61c640")",
"update("user:648ade3b69d58f61c640")",
"delete("user:648ade3b69d58f61c640")",
"read("user:64df7d4a4cb958d68e76")",
]
Which is the same I get from Appwrite.
Question is, why cant I update the permissions in this form?
The full error looks like this:
AppwriteException (AppwriteException: user_unauthorized, Permissions must be one of: (any, users, user:648ade3b69d58f61c640, user:648ade3b69d58f61c640/verified, users/verified) (401))
A user can set permissions of a document to is own or users
or any
to set permission to other users you'll need to use the database server side SDK and you can do so using a function.
Ah okay, I thought a user with write permissions could set the permissions of other users too
SOLVED: Update Document permissions fails: user_unauthorized
Recommended threads
- Attributes Confusion
```import 'package:appwrite/models.dart'; class OrdersModel { String id, email, name, phone, status, user_id, address; int discount, total, created_at; L...
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Edit ID of an existing collection
Hi there. Is it possible to edit an ID of an existing collection? Right now it looks impossible from AppWrite cloud at least.