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 comments(self, id): loggedInUser = helper.getLoggedInUser() if shift.isPublic(id) or (shift.canRead(id, loggedInUser["_id"])): return data(event.eventsForStream(shift.commentStream(id))) else: return error("Operation not permitted. You don't have permission to view comments on this shift.", PermissionError)
def events(self, id): loggedInUser = helper.getLoggedInUser() if stream.canRead(id, loggedInUser["_id"]): return data(event.eventsForStream(id)) else: return error("Operation not permitted. You don't have permission to view events on this stream.", PermissionError)