Exemple #1
0
 def rq_reload_acl_rules(self, id, *args):
     u"""
     Reloads system ACLs database to cache
     """
     ACLDB().reload_rules()
     
     return _(u"ACL Rules reloaded.")
Exemple #2
0
 def __reginit__(self):
     self.authenticated = False
     self.authorized = False
     self.clientdb = ClientDB()
     self.acldb = ACLDB()
     # this one is to do operation on sites from the console
     # or the command line
     self._sitedb = SiteDB()
     self.tags = ACLTags()
Exemple #3
0
    def authorize(self, user_site, client, need_login=False):
        if not isinstance(user_site, SiteInfo):
            if not self.exists(user_site):
                return False
            user, site = self.split_user_site(user_site)
            siteinfo = SiteInfo(user, site)
        else:
            siteinfo = user_site

        if not siteinfo.loaded:
            return False

        if not ACLDB().check(acl='authorize', client=client.get_tags(),
                                              site=siteinfo.get_tags()):
            return False

        self.siteinfo = siteinfo
        if need_login and siteinfo.login is None:
            self.select_login()

        return True
Exemple #4
0
    def authenticate(self, username, auth_tokens, **tokens):
        """
        Authenticate the client connecting as C{username} with C{**tokens}.
        If authentication is successful, set the attribute C{clientinfo} as
        an instance of L{ClientInfo}.
        This only controls the connection from the client to the proxy.

        @param username: the username
        @type username: str
        @param **tokens: the authentication tokens (password, key, ...)
        @type **tokens: dict
        @return: True if authenticated, False otherwise.
        @rtype: bool
        """
        clientinfo = ClientInfo(username, **tokens)

        if not ACLDB().check(acl='authenticate', client=clientinfo.get_tags()):
            return False

        if clientinfo.authenticate(**auth_tokens):
            self.clientinfo = clientinfo
            return True
        else:
            return False
Exemple #5
0
 def func_reload_acl_rules(self, *args):
     ACLDB().reload_rules()
     
     return True
Exemple #6
0
    def func_check_acl(self, _chan, *args, **kw):
        if not len(args):
            return False

        namespaces = self.namespaces[_chan]
        return ACLDB().check(acl=args[0], **namespaces)