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
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to