Custom login controlled by external authorization to enter

Hello:
I need to control the income of the users by means of an external variable. Let me explain: I am developing a system and in the backend I use a variable called “access_status” (boolean) for each user. Basically what I want is that the user can only login if this variable is True, otherwise redirect to another url, any ideas?

thanks for your help

regards

Matias

Where is Grafana in your question?