mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-28 23:12:19 +03:00
remove user session info on logout
This commit is contained in:
parent
7c50a7bc33
commit
25f684f022
1 changed files with 6 additions and 4 deletions
|
@ -233,9 +233,10 @@ class AhenkDeamon(BaseDaemon):
|
||||||
if json_data is not None:
|
if json_data is not None:
|
||||||
scope = Scope().getInstance()
|
scope = Scope().getInstance()
|
||||||
plugin_manager = scope.getPluginManager()
|
plugin_manager = scope.getPluginManager()
|
||||||
|
|
||||||
message_manager = scope.getMessageManager()
|
message_manager = scope.getMessageManager()
|
||||||
messenger = scope.getMessenger()
|
messenger = scope.getMessenger()
|
||||||
|
conf_manager = scope.getConfigurationManager()
|
||||||
|
db_service = scope.getDbService()
|
||||||
|
|
||||||
self.logger.debug('[AhenkDeamon] Signal handled')
|
self.logger.debug('[AhenkDeamon] Signal handled')
|
||||||
self.logger.debug('[AhenkDeamon] Signal is :{}'.format(str(json_data['event'])))
|
self.logger.debug('[AhenkDeamon] Signal is :{}'.format(str(json_data['event'])))
|
||||||
|
@ -248,8 +249,6 @@ class AhenkDeamon(BaseDaemon):
|
||||||
login_message = message_manager.login_msg(username)
|
login_message = message_manager.login_msg(username)
|
||||||
messenger.send_direct_message(login_message)
|
messenger.send_direct_message(login_message)
|
||||||
|
|
||||||
scope.getDbService().update('session', scope.getDbService().get_cols('session'), [username, display, desktop, Util.timestamp()])
|
|
||||||
|
|
||||||
agreement = Agreement()
|
agreement = Agreement()
|
||||||
agreement_choice = False
|
agreement_choice = False
|
||||||
if agreement.check_agreement(username) is False:
|
if agreement.check_agreement(username) is False:
|
||||||
|
@ -257,7 +256,7 @@ class AhenkDeamon(BaseDaemon):
|
||||||
thread_ask = Process(target=agreement.ask, args=(username, display,))
|
thread_ask = Process(target=agreement.ask, args=(username, display,))
|
||||||
thread_ask.start()
|
thread_ask.start()
|
||||||
|
|
||||||
agreement_timeout = scope.getConfigurationManager().get('SESSION', 'agreement_timeout')
|
agreement_timeout = conf_manager.get('SESSION', 'agreement_timeout')
|
||||||
|
|
||||||
timeout = int(agreement_timeout) # sec
|
timeout = int(agreement_timeout) # sec
|
||||||
timer = time.time()
|
timer = time.time()
|
||||||
|
@ -284,11 +283,14 @@ class AhenkDeamon(BaseDaemon):
|
||||||
agreement_choice = True
|
agreement_choice = True
|
||||||
|
|
||||||
if agreement_choice is True:
|
if agreement_choice is True:
|
||||||
|
db_service.delete('session', 'username=\'{}\''.format(username))
|
||||||
|
db_service.update('session', scope.getDbService().get_cols('session'), [username, display, desktop, Util.timestamp()])
|
||||||
get_policy_message = message_manager.policy_request_msg(username)
|
get_policy_message = message_manager.policy_request_msg(username)
|
||||||
messenger.send_direct_message(get_policy_message)
|
messenger.send_direct_message(get_policy_message)
|
||||||
|
|
||||||
elif 'logout' == str(json_data['event']):
|
elif 'logout' == str(json_data['event']):
|
||||||
username = json_data['username']
|
username = json_data['username']
|
||||||
|
db_service.delete('session', 'username=\'{}\''.format(username))
|
||||||
self.logger.info('[AhenkDeamon] logout event is handled for user: {}'.format(username))
|
self.logger.info('[AhenkDeamon] logout event is handled for user: {}'.format(username))
|
||||||
logout_message = message_manager.logout_msg(username)
|
logout_message = message_manager.logout_msg(username)
|
||||||
messenger.send_direct_message(logout_message)
|
messenger.send_direct_message(logout_message)
|
||||||
|
|
Loading…
Reference in a new issue