[IMP] netsvc: removed unused auth param.
The auth param is an auth proxy/provider. The idea is that an auth proxy is associated to some HTTP request handler. The handler can then use it when necessary, depending on the accessed resource. As of now, it is only used by the webdav module. But really, the caldav module accesses the proxy directly on the handler. Currently in web_services, authentication is simply done via security.check(). bzr revid: vmt@openerp.com-20110925152318-i3jvimumm51e2lu4
This commit is contained in:
parent
a254a13dc3
commit
a7a826b2df
|
@ -96,12 +96,9 @@ def LocalService(name):
|
|||
class ExportService(object):
|
||||
""" Proxy for exported services.
|
||||
|
||||
All methods here should take an AuthProxy as their first parameter. It
|
||||
will be appended by the calling framework.
|
||||
|
||||
Note that this class has no direct proxy, capable of calling
|
||||
eservice.method(). Rather, the proxy should call
|
||||
dispatch(method,auth,params)
|
||||
dispatch(method, params)
|
||||
"""
|
||||
|
||||
_services = {}
|
||||
|
@ -118,7 +115,7 @@ class ExportService(object):
|
|||
|
||||
# Dispatch a RPC call w.r.t. the method name. The dispatching
|
||||
# w.r.t. the service (this class) is done by OpenERPDispatcher.
|
||||
def dispatch(self, method, auth, params):
|
||||
def dispatch(self, method, params):
|
||||
raise Exception("stub dispatch at %s" % self.__name)
|
||||
|
||||
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, _NOTHING, DEFAULT = range(10)
|
||||
|
@ -393,7 +390,7 @@ def log(title, msg, channel=logging.DEBUG_RPC, depth=None, fn=""):
|
|||
logger.log(channel, indent+line)
|
||||
indent=indent_after
|
||||
|
||||
def dispatch_rpc(service_name, method, params, auth):
|
||||
def dispatch_rpc(service_name, method, params):
|
||||
""" Handle a RPC call.
|
||||
|
||||
This is pure Python code, the actual marshalling (from/to XML-RPC or
|
||||
|
@ -408,7 +405,7 @@ def dispatch_rpc(service_name, method, params, auth):
|
|||
_log('service', tuple(replace_request_password(params)), depth=None, fn='%s.%s'%(service_name,method))
|
||||
if logger.isEnabledFor(logging.DEBUG_RPC):
|
||||
start_time = time.time()
|
||||
result = ExportService.getService(service_name).dispatch(method, auth, params)
|
||||
result = ExportService.getService(service_name).dispatch(method, params)
|
||||
if logger.isEnabledFor(logging.DEBUG_RPC):
|
||||
end_time = time.time()
|
||||
if not logger.isEnabledFor(logging.DEBUG_RPC_ANSWER):
|
||||
|
|
|
@ -93,7 +93,7 @@ class db(netsvc.ExportService):
|
|||
|
||||
self._pg_psw_env_var_is_set = False # on win32, pg_dump need the PGPASSWORD env var
|
||||
|
||||
def dispatch(self, method, auth, params):
|
||||
def dispatch(self, method, params):
|
||||
if method in [ 'create', 'get_progress', 'drop', 'dump',
|
||||
'restore', 'rename',
|
||||
'change_admin_password', 'migrate_databases',
|
||||
|
@ -368,20 +368,14 @@ class common(netsvc.ExportService):
|
|||
def __init__(self,name="common"):
|
||||
netsvc.ExportService.__init__(self,name)
|
||||
|
||||
def dispatch(self, method, auth, params):
|
||||
def dispatch(self, method, params):
|
||||
logger = netsvc.Logger()
|
||||
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]) # TODO I didn't see any AuthProxy implementing this method.
|
||||
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']:
|
||||
|
@ -562,7 +556,7 @@ class objects_proxy(netsvc.ExportService):
|
|||
def __init__(self, name="object"):
|
||||
netsvc.ExportService.__init__(self,name)
|
||||
|
||||
def dispatch(self, method, auth, params):
|
||||
def dispatch(self, method, params):
|
||||
(db, uid, passwd ) = params[0:3]
|
||||
params = params[3:]
|
||||
if method == 'obj_list':
|
||||
|
@ -595,7 +589,7 @@ class wizard(netsvc.ExportService):
|
|||
self.wiz_name = {}
|
||||
self.wiz_uid = {}
|
||||
|
||||
def dispatch(self, method, auth, params):
|
||||
def dispatch(self, method, params):
|
||||
(db, uid, passwd ) = params[0:3]
|
||||
params = params[3:]
|
||||
if method not in ['execute','create']:
|
||||
|
@ -652,7 +646,7 @@ class report_spool(netsvc.ExportService):
|
|||
self.id = 0
|
||||
self.id_protect = threading.Semaphore()
|
||||
|
||||
def dispatch(self, method, auth, params):
|
||||
def dispatch(self, method, params):
|
||||
(db, uid, passwd ) = params[0:3]
|
||||
params = params[3:]
|
||||
if method not in ['report', 'report_get', 'render_report']:
|
||||
|
|
|
@ -47,7 +47,7 @@ def xmlrpc_return(start_response, service, method, params):
|
|||
# This mimics SimpleXMLRPCDispatcher._marshaled_dispatch() for exception
|
||||
# handling.
|
||||
try:
|
||||
result = openerp.netsvc.dispatch_rpc(service, method, params, None) # TODO auth
|
||||
result = openerp.netsvc.dispatch_rpc(service, method, params)
|
||||
response = xmlrpclib.dumps((result,), methodresponse=1, allow_none=False, encoding=None)
|
||||
except openerp.netsvc.OpenERPDispatcherException, e:
|
||||
fault = xmlrpclib.Fault(openerp.tools.exception_to_unicode(e.exception), e.traceback)
|
||||
|
|
Loading…
Reference in New Issue