Commit e0f6568a authored by Antoine Millet's avatar Antoine Millet
Browse files

Now use account name to evaluate rights

parent 68e1266a
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -239,6 +239,12 @@ class Client(object):
        """
        return self._tql_object

    @property
    def account(self):
        """ Return the login (account) of this client.
        """
        return self._login

    @property
    def login(self):
        """ Return the login of this client.
@@ -387,14 +393,14 @@ class Client(object):
                tag.ttl = ttl

    def list(self, query, show=None, method=None):
        return self._server.list(query, show=show, method=method, requester=self.login)
        return self._server.list(query, show=show, method=method, requester=self.account)

    def check(self, method, query=None):
        if query is not None:
            if not self._server.check(query, self.login, method):
            if not self._server.check(query, self.account, method):
                raise RightError('You don\'t have right to do that')
        else:
            if not self._server.check_method(self.login, method):
            if not self._server.check_method(self.account, method):
                raise RightError('You don\'t have right to do that')

    def register(self, obj_id, role):