def put(self, subforum_id): user = get_user(username=get_jwt_identity()) subforum = get_obj(Subforum.query.filter_by(subforum_id=subforum_id)) check_permissions(user, [ EditSubforum(subforum, attributes=set(request.form)), ]) ret = generic_put(obj=subforum, schema=SubforumSchema(), data=request.form) return ret
def put(self, post_id): user = get_user(username=get_jwt_identity()) post = get_obj(Post.query.filter_by(post_id=post_id)) topic = get_obj(Topic.query.filter_by(topic_id=post.topic_id)) check_permissions(user, [ EditPost(post, attributes=set(request.form)), ]) ret = generic_put(obj=post, schema=PostSchema(exclude=('user_id', 'topic_id')), data=request.form) return ret
def put(self, avatar_id): user = get_user(username=get_jwt_identity()) avatar = get_obj(Avatar.query.filter_by(avatar_id=avatar_id), 'avatar does not exist') check_permissions(user, [ EditAvatar(avatar, attributes=set(request.form)), ]) ret = generic_put(obj=Avatar.query.get(avatar_id), schema=AvatarSchema(), data=request.form) return ret
def put(self, user_id): user = get_user(username=get_jwt_identity()) target_user = get_user(user_id=user_id) #EditUser(target=target_user, attributes=set(request.form)).check(user) check_permissions(user, [ EditUser(target_user, attributes=set(request.form)), ]) ret = generic_put(obj=target_user, schema=UserSchema(), data=request.form) return ret
def put(self, topic_id): user = get_user(username=get_jwt_identity()) topic = get_obj( Topic.query.filter_by(topic_id=topic_id), 'topic not found') check_permissions(user, [ EditTopic(topic, attributes=set(request.form)), ]) ret = generic_put( obj=topic, schema=TopicSchema(), data=request.form ) return ret