Back

how restrict user to execute function only once or 3 times in a day

  • 0
  • Flutter
conqueror
13 Jun, 2023, 16:03

how restrict user to execute function only once or 3 times in a day.

TL;DR
The user wants to restrict the execution of a function to only once or three times per day. One suggestion is to run the function within itself, but it is deemed too complex. Another suggestion is to grant users permission upon login and remove it after a certain number of executions. The user asks if there are any other ways to achieve this restriction. One possible solution is to create a collection with user IDs and the number of executions. The code can then check if the user has reached their execution limit. Additionally, a CRON function can be created to reset the collection every night at midnight.
Binyamin
13 Jun, 2023, 16:05

You'll need to create some inner-logic for that. For example, you can create a collection with

  • User ID,
  • Number of execution

Then check if the user is reached is limit.

Then any night at midnight you can create a CRON function that will empty the collection, so it's ready for the next day.

conqueror
13 Jun, 2023, 16:14

any other way.

Binyamin
13 Jun, 2023, 16:18

A more complex one would be to give any user permission upon login And, then remove it after N execution.

Binyamin
13 Jun, 2023, 16:18

But this is to complex for that task.

Binyamin
13 Jun, 2023, 16:19

I think the best way would be to run the function within the function.

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