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
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
def updateClient(self, mode): t = time() for output in self.last_clients: if bits_set(output, mode): self.last_clients[output] = t
def getTask(self, mode=Output.All): self.updateClient(mode) for task in self.tasks.itervalues(): if mode == Output.All or bits_set(task.output, mode): return task
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)