Cannot be done just once since we may add/remove allowed users at any time, but there are better strategies:
Cache that file for a few seconds
Download a new version only if user is not allowed and recheck permissions, then cache it for some time (e.g. 1 hour) since we may still remove users at any time
Add an admin command that downloads a new copy of the file, never download automatically (very efficient from a network point of view but very cumbersome for admins, I don't like it but it's a possibility)
Every command checks for permissions.
Every check for permissions checks the user list.
Every check to the user list is a connection to OwnCloud, a download and some JSON parsing.
It's right here: https://github.com/WEEE-Open/weeelab-telegram-bot/blob/09f4f9e3ea4218edf1d3dcd4420cc0ec1354d7a0/weeelab_bot.py#L227-L231
Cannot be done just once since we may add/remove allowed users at any time, but there are better strategies: