def delete(self, userId): if userId == "me": valid, req = oauth.verify_request([]) if not valid: raise AuthorizationRequired() unfollow = followParser.parse_args()["otherUser"].split(",") others = [User.get_by_id(u) for u in unfollow] req.user.unfollow(others) return {"success": True}
def post(self, userId): if userId == "me": valid, req = oauth.verify_request([]) follow = followParser.parse_args()["otherUser"].split(",") if not valid: raise AuthorizationRequired() user = req.user others = [User.get_by_id(f) for f in follow] user.follow(others) return {"success": True}
def delete(self, userId): """Unsubscribe the user from a podcast.""" podcast = podcastsParser.parse_args()["podcast"] if userId == "me": valid, req = oauth.verify_request([]) if not valid: raise AuthorizationRequired() user = req.user else: user = User.get_by_id(userId) return user.unsubscribe_by_url(podcast)
def get(self, userId): """Get all the user's subscriptions.""" if userId == "me": valid, req = oauth.verify_request([]) if not valid: raise AuthorizationRequired() user = req.user else: user = User.get_by_id(userId) if not user: abort(404, message="User not found.") return return user.get_subscriptions()
def get(self, userId): """Get a user.""" if userId == "me": valid, req = oauth.verify_request(["publicuserinfo/read"]) if not valid: raise AuthorizationRequired() user = req.user else: user = User.get_by_id(userId) if not user: abort(404, message="User not found: %s." % userId) return # make sure the client is authorized to get the user's email. valid, req = oauth.verify_request(["userinfo/email"]) if not (valid and (userId == "me" or userId == req.user.id)): return AttributeHider(user, ["primary_email"]) return user
def get_node(cls, id): cls.from_db_user(DBUser.get_by_id(id))
def get(self, userId): user = User.get_by_id(userId) return user.following
def user(self): return User.get_by_id(self.user_id)