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 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)