[SOLVED] AppwriteException: user_unauthorized, Permissions must be one of: (any, users, user:...
- 0
- Resolved
- Databases
- Flutter
AppwriteException: user_unauthorized, Permissions must be one of: (any, users, user:64f30beb85479b9d1078, user:64f30beb85479b9d1078/unverified, users/unverified) (401)
final clientProfileId = bookingTimeline.bookingRef.clientProfile.id;
final ownerId = bookingTimeline.bookingRef.service.ownerId;
// final uniqueRoles = {Role.user(clientProfileId), Role.user(ownerId)};
final uniqueRoles = {Role.user(ownerId)};
final permissions = [
for (final role in uniqueRoles) ...[
// Permission.read(role),
Permission.update(role),
Permission.delete(role),
]
];
The error message suggests that the user does not have permissions to perform the action.
actually it have
64f30beb85479b9d1078
is the current user so When I only add this to the permission it successfully created the document
/// the current user
"read("user:64f30beb85479b9d1078")"
"update("user:64f30beb85479b9d1078")"
"delete("user:64f30beb85479b9d1078")"
/// the user owner of the service provider
"read("user:64ecc7a01620c0514f28")"
"update("user:64ecc7a01620c0514f28")"
"delete("user:64ecc7a01620c0514f28")"
but when this is the permission to be settled in during creating the document the error will be occured
It said that , Permissions must be one of: (any, users, user:64f30beb85479b9d1078, user:64f30beb85479b9d1078/unverified, users/unverified)
what I understand is that this user:64ecc7a01620c0514f28 is not allowed to be in the permission for updating, read, and deleting the document permission
That is why I set right now is
"read(users)"
"update("user:64f30beb85479b9d1078")"
"delete("user:64f30beb85479b9d1078")"
But what I want is this /// the current user "read("user:64f30beb85479b9d1078")" "update("user:64f30beb85479b9d1078")" "delete("user:64f30beb85479b9d1078")"
/// the user owner of the service provider "read("user:64ecc7a01620c0514f28")" "update("user:64ecc7a01620c0514f28")" "delete("user:64ecc7a01620c0514f28")"
because I want that both client and the owner of the service provider can read, update, and delete this document, not only the client can have this kind of access
Are you setting these permissions from a client-side application?
yup
I think that's the problem. When you are setting permissions on a document, it's best to do it from a server-sided environment.
ohh I seeee thanks safwan
no worries! let me know if you need any help
[SOLVED] AppwriteException: user_unauthorized, Permissions must be one of: (any, users, user:...
Recommended threads
- [Solved] Appwrite project paused
I have github student account. The auth has been paused however the database is working fine. I cant see any option to resume from my console panel. It is just ...
- MongoDb Database Breaks integer[] & bigi...
I've got a table with the below column created. When I try to insert the value `[-3408048000]` into it, the dart sdk cloud function call is successful (no error...
- 1.9.6 Console handles all array columns ...
When creating or updating a row in the appwrite 1.9.6 web console, the form treats all list columns as a type string. Even if the column is a list of booleans, ...