SimpleRPCServer

Esben Pedersen news.10.e5ke at spamgourmet.com
Fri Mar 25 05:59:45 EST 2005


I am trying to restrict some of the methods available by RPC to whether 
the user is connected through a ssh-tunnel eg. connecting from localhost.

class UserRPC:
     '''Methods available to users'''
     pass

class AdminRPC(UserRPC):
     '''Methods available only when connecting from localhost'''
     pass

class RPCServer(SimpleXMLRPCServer):
     def _dispatch(self, method, args):
         if user_is_connecting_from_localhost():
	    return getattr(AdminRPC(), method)(*args)
         return getattr(UserRPC(), method)(*args)

What i don't know is how to the client ip. I would think I should 
override the _marshalled_dispatch method but I can't quite grasp it all.

/Esben



More information about the Python-list mailing list