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
- 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...
- Appwrite Functions cold start
Hello. I'm seeing really long cold starts on Appwrite Cloud Functions and wanted to know if this is expected. My function just authenticates the user, fetches ...
- Error can not create `tablesdb` event wi...
When i'm trying to add an event with `tablesdb` i get an error message My event value: `tablesdb.mtg-decklist-dev.tables.queue_parsing.rows.*.create` Same err...