Hello,
I encounter a strange bug while working on a web app.
I have two collections with document-level security.
On the collection level, users can create documents, but cannot read, update or delete.
On the documents created by the user, they assign themselves read and update permissions.
When I try to update a document signed in as a user, I get a 401 error:
{
"message": "The current user is not authorized to perform the requested action.",
"code": 401,
"type": "user_unauthorized",
"version": "1.3.7"
}
Appwrite log:
[Error] Method: PATCH
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
[Error] Type: Appwrite\Extend\Exception
[Error] Message: The current user is not authorized to perform the requested action.
[Error] File: /usr/src/code/app/controllers/api/databases.php
[Error] Line: 3295
I know the appwrite session cookie is valid because users can read documents where they have read permission.
The strange thing is that I added Any that can update, and users still can't update the documents.
Also, I have a third collection with the same setup (document-level security, users can create from collection, then update their documents), which is working fine.
The two collections failing have a relationship between them.
I tried from a server-side script (authentified via an API key) to update the document, which is successfull.
Any idea?