Replies: 1 comment
-
To achieve this, you need to create a custom role in Appwrite and assign it to the anonymous users. Here's a step-by-step guide to help you achieve this: Step 1: Create a custom role In the Appwrite console, go to the Roles section and click on Create Role. Give the role a name, e.g., "Anonymous User". Set the Description and Permissions as follows: Description: Anonymous users with read and write permissions In your Kotlin code, when creating an anonymous session using Account(client).createAnonymousSession(), you need to specify the custom role you created. You can do this by adding the roles parameter to the createAnonymousSession method: val account = Account(client) This will assign the "Anonymous User" role to the newly created anonymous user. Step 3: Restrict permissions for other users To prevent other users from reading or writing to the database, you need to update the permissions for the default roles. In the Appwrite console, go to the Roles section and edit the default roles (e.g., "User" and "Admin"). Remove the read and write permissions for the specific database you want to restrict access to. By following these steps, only anonymous users with the "Anonymous User" role will have read and write permissions to the specified database, while other users will not have access. Remember to replace "Anonymous User" with the actual role ID or name you created in Step 1. |
Beta Was this translation helpful? Give feedback.
-
I have created a database from the AppWrite console, from the Android app in Kotlin, I have called
Account(client).createAnonymousSession()
when opening the app to create an anonymous user, and I want these anonymous/unverified users that are created to have permission to read and write, but I don't know how to declare this. I tried this way:But I didn't get it to work, and I don't want other users to be able to do reads or writes, only those that are anonymous/unverified. Thank you very much for your help in advance
Beta Was this translation helpful? Give feedback.
All reactions