def do_sync(WATO=False): if WATO and html.has_var('_sync'): # make sure it is not a browser reload if not html.check_transaction(): return False tag_errors = check_tags() if tag_errors: html.show_error('\n'.join(tag_errors)) return False sync_error = sync_glpi() if sync_error: html.show_error(sync_error) return False html.enable_request_timeout() html.immediate_browser_redirect(1, config_page) elif not WATO and glpi_config['cron']: schedule = load_glpi_schedule() last_run = schedule.get('last_run', 0) last_time = last_scheduled_time(glpi_config['period'], glpi_config['timeofday']) # Do not sync if last_time is less than last_run # when not run in WATO if last_time < last_run: return False tag_errors = check_tags() if tag_errors: return False from wato import load_plugins config.set_user_by_id(glpi_config['cron_user']) load_plugins(True) sync_glpi() return True
def login(user_id): if type(user_id) != unicode: raise MKInternalError("Invalid user id type") config.set_user_by_id(user_id) html.set_user_id(user_id)
def guitest_fake_login(self, user_id): config.set_user_by_id(user_id) self.user = user_id