Back

how i can set a limit for users with a specific label to create a maximum number of documents?

  • 0
  • General
  • Web
manazo
13 Feb, 2024, 08:00

Just like many apps have premium vs free users, and free users can use the app but with some limitations; i wanna implement something similar. in my app, the premium users have a label and the free don't. My plan is that, each free user can create maximum of 4 posts in a bucket, where the premium users can create as many as they want. So i would need a variable in the DB, that no user can update. I also need to implement this checking if any user is creating more documents then that limit number

I could check the db for how many documents the user have already created, before creating each post. but this doesn't sound the perfect way to handle it, also not much secure. Can you think of any way to implement this feature securely within appwrite?

TL;DR
The developer wants to set a limit for users with a specific label to create a maximum number of documents. They want free users to have a limit of 4 documents per bucket, while premium users can create unlimited documents. They are looking for a secure way to implement this feature within Appwrite. A possible solution could be to store a variable in the database that cannot be updated by any user. Before creating each post, check the number of documents the user has already created and compare it to the limit. If it exceeds the limit, prevent the user from creating more documents. This ensures both security and enforcement of the document limit.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more