[sysadmin-bin] Look for the value of current_sign_in_at (it updates on a user entering credentials at a login scree



commit 4f0b3200f3b19598697541406cd74557275beb79
Author: Andrea Veri <averi redhat com>
Date:   Wed Mar 20 23:30:06 2019 +0100

    Look for the value of current_sign_in_at (it updates on a user entering credentials at a login screen) 
instead as there might be a newer session than the one specified on last_sign_in

 gitlab/inactive-gitlab-users.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gitlab/inactive-gitlab-users.py b/gitlab/inactive-gitlab-users.py
index 952f707..d042c75 100755
--- a/gitlab/inactive-gitlab-users.py
+++ b/gitlab/inactive-gitlab-users.py
@@ -15,13 +15,13 @@ whitelist = ['debian', 'ubuntu', 'redhat',
              'canonical', 'suse', 'fedoraproject',
              'gnome']
 
-print 'username,email,id,created_at,last_sign_in_at'
+print 'username,email,id,created_at,current_sign_in_at'
 
 for user in users:
     for index, _ in enumerate(user.attributes['identities']):
         if user.attributes['identities'][index]['provider'] != 'ldapmain':
             if user.attributes['last_activity_on'] == None:
                 if user.attributes['email'].split('@')[1].split('.')[-2] not in whitelist:
-                    if user.attributes['created_at'].split('T')[0] == 
user.attributes['last_sign_in_at'].split('T')[0]:
+                    if user.attributes['created_at'].split('T')[0] == 
user.attributes['current_sign_in_at'].split('T')[0]:
                         if dt.datetime.strptime(user.attributes['created_at'].split('T')[0], 
'%Y-%m-%d').date() < (today - timedelta):
-                            print '{},{},{},{},{}'.format(user.attributes['username'], 
user.attributes['email'], user.attributes['id'], user.attributes['created_at'].split('T')[0], 
user.attributes['last_sign_in_at'].split('T')[0])
+                            print '{},{},{},{},{}'.format(user.attributes['username'], 
user.attributes['email'], user.attributes['id'], user.attributes['created_at'].split('T')[0], 
user.attributes['current_sign_in_at'].split('T')[0])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]