Back

[SOLVED] I cannot figure Out how Permissions are functioning.... But obviously are not working

  • 0
  • Web
Tassos P.
14 Jul, 2023, 10:00

I have recently upgrade my appwrie installation to 1.3.7 (just mentioning) though I had the problem since the first installation. I have created 1 collection and I have just authenticated users and a Team of admins with just one user. What I want is every user to create a "message" and be able to read it or update only (write/read/update) it by him and the group of admins. And the admins should be able to (read/write/update/delete). Yet I cannot manage it since it fails all the time..... I do not know what is wrong

I ve setup the permissions when document is created like below:

try { e.preventDefault(); await database.createDocument( osekaDbId, messagesCollection, ID.unique(), data, [ Permission.write(Role.user(userId)), Permission.read(Role.user(userId)), Permission.update(Role.user(userId)), Permission.write(Role.team("64afcc97eb1b82460227")), Permission.read(Role.team("64afcc97eb1b82460227")), Permission.update(Role.team("64afcc97eb1b82460227")), Permission.delete(Role.team("64afcc97eb1b82460227")), ] ); navigate("/documents"); } catch (error) { console.log(${error.message}); } };

and when I try to create a new document I get this error:

Permissions must be one of: (any, users, user:64838b79042f121f73d6, user:64838b79042f121f73d6/verified, users/verified)

and my collection permissions are setup like in the screenshot attached!

Can someone advise me?

THANK YOU!!!

TL;DR
The user is having trouble with permissions in their appwire installation. They want users to be able to create and read their own messages, and admins to have full permission. They set up the permissions when creating a document but are getting an error. They included a screenshot of their collection permissions. They are asking for advice on how to fix the issue. Solution: The user's permissions are not formatted correctly. They need to use the specific role names for permissions instead of the user or team IDs. They should change "Role.user(userId)" to "Role.users()" and "Role.team("64afcc97eb1b82460227")
Tassos P.
14 Jul, 2023, 13:05

[SOLVED] I cannot figure Out how Permissions are functioning.... But obviously are not working

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