I'm working with function, which should generate a document in Collection B, but only if user who's calling the function, is the owner of Document in Collection A.
Function is getting documentId as parameter through request body, but I'm wondering how can I access which user is making the actual function call, since I should fetch the documentId document from Collection A, and compare if caller matched documentA.ownerId field.
I'm excecuting the function through node-appwrite sessionClient, so call is made as logged in user, and actual call permission is checked by Functions own excecution access.
You can get the authenticated user id with
const userId = req.headers['x-appwrite-user-id'];
Recommended threads
- Function domain not available
Hello, even tho in docs you clearly describe that every function has its domain, I can not see it anywhere in any of my projects. How do I reveal the url of th...
- Inquiry: How to Reduce Cold Start Durati...
Hey! I was using Python for the function runtime, but after reading that Go has the fastest runtime, I switched my code over to Go. However, I'm still seeing co...
- After a GET request is passed to functio...
Create execution in the console can normally retrieve the get parameters。WHy?