how are you executing the function?
I am trying to add permission to the user who is deleting a document. I am comparing the user id with the owner of the document, and if they are the same, the user should have permission to delete the document. When I try to log the user id from the server, it is not the same as my user id.
IN authorization, my user id is different. What is the problem?
After I execute the function, the document wont be deleted even thought the owner of the document is the same as my user id. Should I use another logic?
how are you executing the function?
By sending the json payload after clicking the buttin execute in appwrite
so in the Appwrite Console. This executes the function as your Console Account. which is not a user in your project.
how can i solve this?
what should I do in order for the function_user_id to be the same as the id of the user in the project
The user account in your console is not the same as the user account as someone who uses your client-side app.
If you want the app's user account, you'll have to create an execution on the client-side.
is there any other way to get the user id on the server side?
You can manually pass it in the payload
Okay thanks
Recommended threads
- Worker functions stuck on "Fetched 0 fun...
Appwrite Version: 1.9.0 Bug Description: The appwrite-worker-functions container gets stuck in an infinite loop logging "Fetched 0 functions..." while scheduled...
- I am using s3 for app storage but is it ...
_APP_STORAGE_DEVICE=s3 puts everything to the s3 storage but i need to be able to keep the function builds and site in the local and not waste the cloud storage...
- Local Serverless Function Testing: Are D...
I have followed the instructions to get the CLI working, and have been able to log-in, initialize my project, and created a simple Python function, which calls ...