def getTasks(self, user, mode=IA.All):
        # update last active clients
        self.last_clients[user] = time()

        # filter current mode
        tasks = [t for t in self.tasks.itervalues() if mode == IA.All or bits_set(t.type, mode)]
        # filter correct user / or shared
        tasks = [t for t in tasks if user is None or user == t.owner or t.shared]

        return tasks
Beispiel #2
0
    def getTasks(self, user, mode=IA.All):
        # update last active clients
        self.last_clients[user] = time()

        # filter current mode
        tasks = [
            t for t in self.tasks.itervalues()
            if mode == IA.All or bits_set(t.type, mode)
        ]
        # filter correct user / or shared
        tasks = [
            t for t in tasks if user is None or user == t.owner or t.shared
        ]

        return tasks
Beispiel #3
0
    def hasPermission(self, perms):
        """  Accepts permission bit or name  """
        if isinstance(perms, basestring) and hasattr(Permission, perms):
            perms = getattr(Permission, perms)

        return bits_set(perms, self.permission)
Beispiel #4
0
    def hasPermission(self, perms):
        """  Accepts permission bit or name  """
        if isinstance(perms, basestring) and hasattr(Permission, perms):
            perms = getattr(Permission, perms)

        return bits_set(perms, self.permission)