devices, ip attributes
This commit is contained in:
parent
5f3bbd0ff4
commit
48be235fde
11
app.py
11
app.py
@ -1027,7 +1027,10 @@ def get_user_data(user_dn, conn):
|
|||||||
data.append(conn.entries[0].uid.values[0])
|
data.append(conn.entries[0].uid.values[0])
|
||||||
data.append(conn.entries[0].mail.values[0])
|
data.append(conn.entries[0].mail.values[0])
|
||||||
data.append(conn.entries[0].devices.values)
|
data.append(conn.entries[0].devices.values)
|
||||||
|
if(conn.entries[0].ip):
|
||||||
data.append(conn.entries[0].ip.values[0])
|
data.append(conn.entries[0].ip.values[0])
|
||||||
|
else:
|
||||||
|
data.append(request.environ.get('HTTP_X_REAL_IP', request.remote_addr))
|
||||||
#ts = conn.entries[0].lastLogin.values[0]
|
#ts = conn.entries[0].lastLogin.values[0]
|
||||||
#ts = datetime.strptime(ts, '%Y-%m-%d %H:%M:%S%z')
|
#ts = datetime.strptime(ts, '%Y-%m-%d %H:%M:%S%z')
|
||||||
#ts = datetime.strftime(t, '%Y-%m-%d %H:%M:%S')
|
#ts = datetime.strftime(t, '%Y-%m-%d %H:%M:%S')
|
||||||
@ -1074,14 +1077,6 @@ def is_trusted_device(conf, user_dn):
|
|||||||
if not find_device(user_dn, c, d):
|
if not find_device(user_dn, c, d):
|
||||||
OBJECT_CLASS = ['top', 'inetOrgPerson', 'posixAccount', 'accountsManagement']
|
OBJECT_CLASS = ['top', 'inetOrgPerson', 'posixAccount', 'accountsManagement']
|
||||||
c.modify(user_dn, {'devices': [( MODIFY_ADD, d )] })
|
c.modify(user_dn, {'devices': [( MODIFY_ADD, d )] })
|
||||||
'''
|
|
||||||
if find_device(user_dn, c, 'unknown'):
|
|
||||||
OBJECT_CLASS = ['top', 'inetOrgPerson', 'posixAccount', 'accountsManagement']
|
|
||||||
c.modify(user_dn, {'devices': [( MODIFY_REPLACE, d )] })
|
|
||||||
else:
|
|
||||||
OBJECT_CLASS = ['top', 'inetOrgPerson', 'posixAccount', 'accountsManagement']
|
|
||||||
c.modify(user_dn, {'devices': [( MODIFY_ADD, d )] })
|
|
||||||
'''
|
|
||||||
c.unbind()
|
c.unbind()
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user