
I have a collection that has write-only permission for all users, and the remaining permissions are based on the user ID. The Apple SDK is working fine as expected, meaning a user can only see their own entries.
However, I'm facing an issue with my Python cloud function, which needs to read data specific to a particular user ID. I want to list documents that are specific to the requested user instead of displaying the entire collection.
Quick help appreciated, Between this is crucial for the hackathon!

When executing a function, if it is done by the user then the current user JWT is being sent.
That means you can initialize your function client using the user JWT.
Making use of the user JWT will make sure only documents that available for the user will return. Just like you're using the swift SDK.

First you can find out about function variables here https://appwrite.io/docs/functions#functionVariables

Then, You can make something like what you can see here: https://discord.com/channels/564160730845151244/1102768921846755432/1102770961746505862

Thanks @Binyamin, I can almost see it but I have userId mismatch.
{"executedBy":"64630bd18715e9d8b0a9","jwt":"xxxxxxxxxxxxxxxx","message":"Successfully Generated","sessionId":"6489b3a7ba985cb71e11","timestamp":"2023-06-14 12:57:28","userId":"64892bc8d83bfea54d34"}
userId is passing from local - exists in project executedBy function variable user id - does not exists in project

What is this object?

How have you initialized the client?

class NetworkManager {
static let shared = NetworkManager()
let client: Client
let account: Account
let databases: Databases
let functions: Functions
let storage: Storage
private init() {
self.client = Client()
.setEndpoint(K.END_POINT)
.setProject(K.PROJECT_ID)
.setSelfSigned()
self.account = Account(client)
self.databases = Databases(client)
self.functions = Functions(client)
self.storage = Storage(client)
Task { try! await listSessions() } }
Recommended threads
- Why "You’ve reached the limit for your G...
Why did Appwrite send me this alert when the usage reached 10605%? Is it too late? Why not when reached 100% usage? And I can not pay for more usage described ...
- Subdomain failed verification
So I wanted to do a custom subdomain, because local storage doesn't work for me, but I've tried it a long time ago, it didn't work for me, and now I'm trying ag...
- Sites 30MB limit from GitHub
I’m deploying a site from github as Other type on the Hobby plan. It is actually a Flutter web app but it’s in a subdirectory with the root being an html landin...
