diff --git a/user_managment/app.py b/user_managment/app.py
index b914ac2..0e9ae29 100644
--- a/user_managment/app.py
+++ b/user_managment/app.py
@@ -951,9 +951,12 @@ def create_app():
elif request.args.get('flush_user_db') == 'true' and request.args.get('portal_username'):
content = '''
Flushed auth DB for: ''' + request.args.get('portal_username') + '''
\n'''
authlog_flush_user(request.args.get('portal_username'))
- elif request.args.get('flush_user_mmdvm') == 'true' and request.args.get('mmdvm_server'):
+ elif request.args.get('flush_db_mmdvm') == 'true' and request.args.get('mmdvm_server'):
content = '''Flushed auth DB for: ''' + request.args.get('mmdvm_server') + '''
\n'''
authlog_flush_mmdvm_server(request.args.get('mmdvm_server'))
+ elif request.args.get('flush_db_ip') == 'true' and request.args.get('peer_ip'):
+ content = '''Flushed auth DB for: ''' + request.args.get('peer_ip') + '''
\n'''
+ authlog_flush_ip(request.args.get('peer_ip'))
elif request.args.get('flush_dmr_id_db') == 'true' and request.args.get('dmr_id'):
content = '''Flushed auth DB for: ''' + request.args.get('dmr_id') + '''
\n'''
authlog_flush_dmr_id(request.args.get('dmr_id'))
@@ -1007,8 +1010,8 @@ def create_app():
content = content + '''
''' + str(i.login_dmr_id) + ''' |
- ''' + i.portal_username + ''' |
- ''' + i.peer_ip + ''' |
+ ''' + i.portal_username + ''' |
+ ''' + str(i.peer_ip) + ''' |
''' + i.login_auth_method + ''' |
''' + str(i.server_name) + ''' |
''' + str(i.login_time) + ''' |
@@ -1019,8 +1022,8 @@ def create_app():
content = content + '''
''' + str(i.login_dmr_id) + ''' |
- ''' + i.portal_username + ''' |
- ''' + i.peer_ip + ''' |
+ ''' + i.portal_username + ''' |
+ ''' + str(i.peer_ip) + ''' |
''' + i.login_auth_method + ''' |
''' + str(i.server_name) + ''' |
''' + str(i.login_time) + ''' |
@@ -1032,7 +1035,7 @@ def create_app():
''' + str(i.login_dmr_id) + ''' |
''' + i.portal_username + ''' |
- ''' + i.peer_ip + ''' |
+ ''' + str(i.peer_ip) + ''' |
''' + i.login_auth_method + ''' |
''' + str(i.server_name) + ''' |
''' + str(i.login_time) + ''' |
@@ -1041,8 +1044,7 @@ def create_app():
'''
content = content + ''
- elif request.args.get('mmdvm_server'):
- print('mmdvm')
+ elif request.args.get('mmdvm_server') and not request.args.get('flush_db_mmdvm'):
a = AuthLog.query.filter_by(server_name=request.args.get('mmdvm_server')).order_by(AuthLog.login_time.desc()).all()
content = '''
@@ -1080,8 +1082,8 @@ def create_app():
content = content + '''
''' + str(i.login_dmr_id) + ''' |
- ''' + i.portal_username + ''' |
- ''' + i.peer_ip + ''' |
+ ''' + i.portal_username + ''' |
+ ''' + str(i.peer_ip) + ''' |
''' + i.login_auth_method + ''' |
''' + i.server_name + ''' |
''' + str(i.login_time) + ''' |
@@ -1092,8 +1094,8 @@ def create_app():
content = content + '''
''' + str(i.login_dmr_id) + ''' |
- ''' + i.portal_username + ''' |
- ''' + i.peer_ip + ''' |
+ ''' + i.portal_username + ''' |
+ ''' + str(i.peer_ip) + ''' |
''' + i.login_auth_method + ''' |
''' + i.server_name + ''' |
''' + str(i.login_time) + ''' |
@@ -1105,7 +1107,7 @@ def create_app():
''' + str(i.login_dmr_id) + ''' |
''' + i.portal_username + ''' |
- ''' + i.peer_ip + ''' |
+ ''' + str(i.peer_ip) + ''' |
''' + i.login_auth_method + ''' |
''' + i.server_name + ''' |
''' + str(i.login_time) + ''' |
@@ -1113,6 +1115,78 @@ def create_app():
'''
content = content + ''
+
+ elif request.args.get('peer_ip') and not request.args.get('flush_db_ip'):
+ a = AuthLog.query.filter_by(peer_ip=request.args.get('peer_ip')).order_by(AuthLog.login_time.desc()).all()
+ content = '''
+
+ Flush authentication log for IP: ''' + request.args.get('peer_ip') + '''
+ Log for IP address: ''' + request.args.get('peer_ip') + '''
+
+
+ '
else:
#a = AuthLog.query.all().order_by(AuthLog.login_dmr_id)
@@ -1158,7 +1232,7 @@ def create_app():
''' + str(i.login_dmr_id) + ''' |
''' + i.portal_username + ''' |
- ''' + i.peer_ip + ''' |
+ ''' + str(i.peer_ip) + ''' |
''' + i.login_auth_method + ''' |
''' + str(i.server_name) + ''' |
''' + str(i.login_time) + ''' |
@@ -1170,7 +1244,7 @@ def create_app():
''' + str(i.login_dmr_id) + ''' |
''' + i.portal_username + ''' |
- ''' + i.peer_ip + ''' |
+ ''' + str(i.peer_ip) + ''' |
''' + i.login_auth_method + ''' |
''' + str(i.server_name) + ''' |
''' + str(i.login_time) + ''' |
@@ -1182,7 +1256,7 @@ def create_app():
''' + str(i.login_dmr_id) + ''' |
''' + i.portal_username + ''' |
- ''' + i.peer_ip + ''' |
+ ''' + str(i.peer_ip) + ''' |
''' + i.login_auth_method + ''' |
''' + str(i.server_name) + ''' |
''' + str(i.login_time) + ''' |
@@ -1362,6 +1436,11 @@ def create_app():
for i in flush_e:
db.session.delete(i)
db.session.commit()
+ def authlog_flush_ip(_ip):
+ flush_e = AuthLog.query.filter_by(peer_ip=_ip).all()
+ for i in flush_e:
+ db.session.delete(i)
+ db.session.commit()
@app.route('/add_user', methods=['POST', 'GET'])
@login_required