hy
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. Binyamin
Sure
- Inside the header
x-appwrite-user-id
you'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
owner
role
hy
Thank you π
Drake
[SOLVED] Create team in fuction
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Project in AppWrite Cloud doesn't allow ...
I have a collection where the data can't be opened. When I check the functions, there are three instances of a function still running that can't be deleted. The...
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...