conf agreement parameter checker added

This commit is contained in:
volkansahin 2017-07-18 10:06:26 +03:00
parent 2285832b9d
commit fe2856d3d0

View file

@ -27,11 +27,11 @@ class CommandRunner(object):
self.execute_manager = scope.get_execution_manager() self.execute_manager = scope.get_execution_manager()
def check_last_login(self): def check_last_login(self):
last_login_tmstmp=self.db_service.select_one_result('session', 'timestamp') last_login_tmstmp = self.db_service.select_one_result('session', 'timestamp')
if not last_login_tmstmp: if not last_login_tmstmp:
return True return True
if (int(time.time())-int(last_login_tmstmp))<10: if (int(time.time()) - int(last_login_tmstmp)) < 10:
return False return False
else: else:
return True return True
@ -72,7 +72,7 @@ class CommandRunner(object):
agreement = Agreement() agreement = Agreement()
agreement_choice = None agreement_choice = None
if agreement.check_agreement(username) is not True: if agreement.check_agreement(username) is not True and System.Ahenk.agreement() == '1':
self.logger.debug('User {0} has not accepted agreement.'.format(username)) self.logger.debug('User {0} has not accepted agreement.'.format(username))
thread_ask = Process(target=agreement.ask, args=(username, display,)) thread_ask = Process(target=agreement.ask, args=(username, display,))
thread_ask.start() thread_ask.start()
@ -110,7 +110,7 @@ class CommandRunner(object):
else: else:
agreement_choice = True agreement_choice = True
if agreement_choice is True: if agreement_choice is True or System.Ahenk.agreement() != '1':
self.db_service.delete('session', 'username=\'{0}\''.format(username)) self.db_service.delete('session', 'username=\'{0}\''.format(username))
self.logger.info( self.logger.info(
@ -118,7 +118,7 @@ class CommandRunner(object):
username)) username))
session_columns = self.db_service.get_cols('session') session_columns = self.db_service.get_cols('session')
self.db_service.update('session', session_columns, self.db_service.update('session', session_columns,
[username, display, desktop, str(int(time.time())),ip]) [username, display, desktop, str(int(time.time())), ip])
get_policy_message = self.message_manager.policy_request_msg(username) get_policy_message = self.message_manager.policy_request_msg(username)
self.plugin_manager.process_mode('safe', username) self.plugin_manager.process_mode('safe', username)
@ -209,4 +209,4 @@ class CommandRunner(object):
for plugin in self.plugin_manager.plugins: for plugin in self.plugin_manager.plugins:
if plugin.keep_run is True: if plugin.keep_run is True:
return False return False
return True return True