Back

[SOLVED] Permissions must be one of (any, guests)

  • 0
  • Databases
ianmont
21 Mar, 2023, 00:03

When i try to create a document with custom permissions it throws me the error: Permissions must be one of: (any, guests).

why does this is happening?

TL;DR
The user is experiencing an error where they cannot create a document with custom permissions. They are trying to give themselves update access, but it's not working because they are unauthenticated. The solution is to enable document-level permissions and allow users to create documents, and then manually assign the update permission to themselves when creating the document. They should not enable update access for all users in the collection permissions, as that would be a security breach. The error occurs because the permissions must be one of (any, guests).
Drake
21 Mar, 2023, 00:06

A user cannot grant permissions they do not have. In your case here, the user is unauthenticated so they can't put user uuid242

ianmont
21 Mar, 2023, 02:46

thanks Steven for the reply

a user can't give themselves update permissions if the collection permissions doesn't allow it, right?

For example, my user is already authenticated in my app and I want to update a value in a document that only my authenticated user is allowed to update, that means that nobody can update that document because it does not correspond to them. My idea is that this document has an update permission for my authenticated user and I assign that permission to him when I create the document.

However, as a user cannot be granted permissions that they do not have, then I get an error that I cannot add the update permission for that document.

The error goes away if I put allow update for all users in the collection permissions, however it is not what I want since anyone could update documents from others and that would be a security breach.

How could I create the document with update permissions only for my authenticated user, without having to allow the entire collection permissions to update?

ianmont
21 Mar, 2023, 02:48

Also if it helps this are my collection permissions:

Drake
21 Mar, 2023, 02:57

You need to enable document level permissions and allow users to create documents. When they create the document, they can put themselves for update access so they can update.

The error in your original post is occurring because you're not authenticated

ianmont
21 Mar, 2023, 03:01

The document level permissions is activated through the Document Security tab? I attach photo, like this?

ianmont
21 Mar, 2023, 03:06

And with that activated, then when a user, being authenticated in the app, creates the document, do I manually assign the "update document" permission or is it assigned by itself?

manazo
30 Oct, 2023, 07:52

Hi @Steven. My collection has document level permission enabled and have create permission for any. but i'm still getting the same error. any idea what's happening?

Drake
31 Oct, 2023, 01:29

please create a new post instead of posting in someone else's thread

Drake
1 Nov, 2023, 15:07

by default, if you don't pass any permissions, the user creating the document gets update, read, and delete access

Drake
1 Nov, 2023, 15:07

is there anything else you need or can this be marked as solved?

ianmont
6 Nov, 2023, 20:04

[SOLVED] Permissions must be one of (any, guests)

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