def messages(self, userName): loggedInUser = helper.getLoggedInUser() messageStream = user.messageStream(user.idForName(userName)) if stream.canRead(messageStream, loggedInUser["_id"]): return data(event.joinData(event.eventsForStream(messageStream))) else: return error("You do not have permission to view this user's messages.", PermissionError)
def read(self, id): loggedInUser = helper.getLoggedInUser() if stream.canRead(id, loggedInUser["_id"]): return data(stream.read(id)) else: return error("Operation not permitted. You don't have permission to view this stream.", PermissionError)