Can I check whether the user sending the request is premium in appwrite functions, create a team within the function, and assign the user sending the request as the team owner?
TL;DR
1. You can retrieve the user ID from the `x-appwrite-user-id` header in the header.
2. Use the `listMemberships` function to check the user's membership status.
3. Utilize the Team Server SDK to add the user to the team as the owner.Sure
- Inside the header
x-appwrite-user-idyou'll have the user ID. - Then you can use the `listMemberships` to check the user membership status
- Then you can use the Team Server SDK to add the user to the team and give the user the
ownerrole
Thank you 🙂
[SOLVED] Create team in fuction
Recommended threads
- 408 Timeout / Curl Error 7 in Executor w...
Hey everyone, I am losing my mind over a routing loop/timeout issue on a fresh self-hosted setup. I have a single Linux VPS (IP: 45.141.37.105) and one domain (...
- functions returning error 401 in local
I updated to 1.9.0, and the functions that used to work fine in 1.8.1 are now giving me a 401 error. I can't seem to find a solution. If anyone is running versi...
- router_deployment_not_found
I updated my function a few times and now i am getting the error: router_deployment_not_found I even reverted back to my original code but i am still getting th...