def dispatch(self, method, auth, params): logger = netsvc.Logger() if method in [ 'ir_set','ir_del', 'ir_get' ]: return self.common_dispatch(method,auth,params) if method == 'login': # At this old dispatcher, we do NOT update the auth proxy res = security.login(params[0], params[1], params[2]) msg = res and 'successful login' or 'bad login or password' # TODO log the client ip address.. logger.notifyChannel("web-service", netsvc.LOG_INFO, "%s from '%s' using database '%s'" % (msg, params[1], params[0].lower())) return res or False elif method == 'logout': if auth: auth.logout(params[1]) logger.notifyChannel("web-service", netsvc.LOG_INFO,'Logout %s from database %s'%(login,db)) return True elif method in ['about', 'timezone_get', 'get_server_environment', 'login_message','get_stats', 'check_connectivity', 'list_http_services']: pass elif method in ['get_available_updates', 'get_migration_scripts', 'set_loglevel', 'get_os_time', 'get_sqlcount']: passwd = params[0] params = params[1:] security.check_super(passwd) else: raise Exception("Method not found: %s" % method) fn = getattr(self, 'exp_'+method) return fn(*params)
def dispatch(self, method, params): if method in [ "login", "about", "timezone_get", "get_server_environment", "login_message", "get_stats", "check_connectivity", "list_http_services", "version", "authenticate", ]: pass elif method in [ "get_available_updates", "get_migration_scripts", "set_loglevel", "get_os_time", "get_sqlcount", ]: passwd = params[0] params = params[1:] security.check_super(passwd) else: raise Exception("Method not found: %s" % method) fn = getattr(self, "exp_" + method) return fn(*params)
def dispatch(self, method, auth, params): logger = netsvc.Logger() if method in [ 'ir_set','ir_del', 'ir_get' ]: return self.common_dispatch(method,auth,params) if method == 'login': # At this old dispatcher, we do NOT update the auth proxy res = security.login(params[0], params[1], params[2]) msg = res and 'successful login' or 'bad login or password' # TODO log the client ip address.. logger.notifyChannel("web-service", netsvc.LOG_INFO, "%s from '%s' using database '%s'" % (msg, params[1], params[0].lower())) return res or False elif method == 'logout': if auth: auth.logout(params[1]) logger.notifyChannel("web-service", netsvc.LOG_INFO,'Logout %s from database %s'%(login,db)) return True elif method in ['about', 'timezone_get', 'get_server_environment', 'login_message','get_stats', 'check_connectivity']: pass elif method in ['get_available_updates', 'get_migration_scripts', 'set_loglevel']: passwd = params[0] params = params[1:] security.check_super(passwd) else: raise Exception("Method not found: %s" % method) fn = getattr(self, 'exp_'+method) return fn(*params)
def dispatch(self, method, auth, params): if method == 'drop': passwd = params[0] params = params[1:] security.check_super_dropdb(passwd) elif method in ('dump', 'dump_file'): passwd = params[0] params = params[1:] security.check_super_bkpdb(passwd) elif method in ('restore', 'restore_file'): passwd = params[0] params = params[1:] security.check_super_restoredb(passwd) elif method in [ 'create', 'get_progress', 'rename', 'change_admin_password', 'migrate_databases' ]: passwd = params[0] params = params[1:] security.check_super(passwd) elif method in [ 'db_exist', 'list', 'list_lang', 'server_version', 'check_timezone', 'connected_to_prod_sync_server' ]: # params = params # No security check for these methods pass else: raise KeyError("Method not found: %s" % method) fn = getattr(self, 'exp_'+method) return fn(*params)
def dispatch(method, params): if method in ['login', 'about', 'timezone_get', 'version', 'authenticate']: pass elif method in ['set_loglevel']: passwd = params[0] params = params[1:] security.check_super(passwd) else: raise Exception("Method not found: %s" % method) fn = globals()['exp_' + method] return fn(*params)
def dispatch(self, method, params): if method in ['login', 'about', 'timezone_get', 'get_server_environment', 'login_message','get_stats', 'check_connectivity', 'list_http_services', 'version', 'authenticate']: pass elif method in ['get_available_updates', 'get_migration_scripts', 'set_loglevel', 'get_os_time', 'get_sqlcount']: passwd = params[0] params = params[1:] security.check_super(passwd) else: raise Exception("Method not found: %s" % method) fn = getattr(self, 'exp_'+method) return fn(*params)
def dispatch(self, method, auth, params): if method in [ 'create', 'get_progress', 'drop', 'dump', 'restore', 'rename', 'change_admin_password', 'migrate_databases' ]: passwd = params[0] params = params[1:] security.check_super(passwd) elif method in [ 'db_exist', 'list', 'list_lang', 'server_version' ]: # params = params # No security check for these methods pass else: raise KeyError("Method not found: %s" % method) fn = getattr(self, 'exp_'+method) return fn(*params)
def dispatch(method, params): if method in ['create', 'get_progress', 'drop', 'dump', 'restore', 'rename', 'change_admin_password', 'migrate_databases', 'create_database', 'duplicate_database']: passwd = params[0] params = params[1:] security.check_super(passwd) elif method in ['db_exist', 'list', 'list_lang', 'server_version']: # params = params # No security check for these methods pass else: raise KeyError("Method not found: %s" % method) fn = globals()['exp_' + method] return fn(*params)
def authenticate(self, db, user, passwd, client_address): try: if user == 'root' and security.check_super(passwd, client_address): return True except security.ExceptionNoTb: return False return False
def dispatch(self, method, params): if method in [ "create", "get_progress", "drop", "dump", "restore", "rename", "change_admin_password", "migrate_databases", "create_database", "duplicate_database", ]: passwd = params[0] params = params[1:] security.check_super(passwd) elif method in ["db_exist", "list", "list_lang", "server_version"]: # params = params # No security check for these methods pass else: raise KeyError("Method not found: %s" % method) fn = getattr(self, "exp_" + method) return fn(*params)