Hi, im trying to set up a database collection so users from the client-side can only view/interact with their own row, so if they are signed in to the correct account. How can i do this? In similar tools you can set access rules, so if logged in user email is equal to specific row allow access, where is this in appwrite?
You can go one of two ways.
- Set the collection permission so any user can only create documents.
 
Then, create a function and let to be triggered new document is created in the collection.
If for example the collection id is aaaaaa then this would be the right trigger for it databases.*.collections.aaaaa.create
Then inside that function you can  adjust the permissions to allow the user to also read the document.
- Move everything to a function. 
Block any access to your collection
And inside your function you can use the variable 
APPWRITE_FUNCTION_USER_IDto get the user id and then do something like this 
 const currentUserId = req.variables.APPWRITE_FUNCTION_USER_ID?? null;
if(currentUserId !== null){
  await databases.createDocument(
    '[DATABASE_ID]',
    '[COLLECTION_ID]',
    {},
    [
        Permission.write(Role.team(currentUserID)),          
    ]
  );
}
This the correct image for the first solution.
👍
[SOLVED] Make users only able to view their own entry in the collection
Recommended threads
- Dynamic Roles
I tried to store a row with this permissions: permissions.push( Permission.read(Role.users("verified")), Permission.write(Role.label(`c-${calend...
 - appwrite auth problem regarding the sess...
Hi, I have problem with auth. When I try to login/signup using OTP, at the end session.secret is empty, i have searched online and in the docs but i cannot find...
 - log out failure
I am trying to set up the user sign up/log in/log out and while I have got the sign up/log in to work, log out keeps failing. i am keeping it simple with only r...