Generate a list of Authenticated Users

Need to create a list of users that are currently authenticated with CloudBolt?

First and foremost understand that unless you have the setting in "Admin > Inactivity timeout minutes" set to a value, a users will remain authenticated until they explicitly logout. If this isn't set, every user that has authenticated will be return by the script that follows.

After running /opt/cloudbolt/ shell_plus, enter the script:

for u in [u for u in User.objects.order_by('-last_login') if u.is_authenticated()]:
   print u.last_login, u.username 

This will return a list of authenticated users sorted in descending order of their last login date/time.

Have more questions? Submit a request


Please sign in to leave a comment.