def _get_user_id_from_post(self): if current_post: return current_post.user_id elif current_topic: return current_topic.user_id else: raise FlaskBBError("Could not determine user")
def fulfill(self, user): if not current_forum: raise FlaskBBError("Could not load forum data") forum_groups = {g.id for g in current_forum.groups} user_groups = {g.id for g in user.groups} return bool(forum_groups & user_groups)
def _get_topic_from_request(self, request): view_args = request.view_args if 'post_id' in view_args: return (Topic.query.join(Post, Post.topic_id == Topic.id).join( Forum, Forum.id == Topic.forum_id).filter( Post.id == view_args['post_id']).with_entities( Topic.locked, Forum.locked).first()) elif 'topic_id' in view_args: return (Topic.query.join(Forum, Forum.id == Topic.forum_id).filter( Topic.id == view_args['topic_id']).with_entities( Topic.locked, Forum.locked).first()) else: raise FlaskBBError("How did you get this to happen?")
def fulfill(self, user): if not hub_current_server: raise FlaskBBError("Could not get current server id") return bool(Permission(Has(hub_current_server.management_permission), identity=user))
def _get_forum_from_request(self): if not current_forum: raise FlaskBBError("Could not load forum data") return current_forum
def _get_forum_from_request(self): if current_forum: return current_forum raise FlaskBBError("Could not determine forum")
def _get_topic_from_request(self): if current_topic: return current_topic.locked, current_forum.locked else: raise FlaskBBError("How did you get this to happen?")
def fulfill(self, user, request): if not current_forum: raise FlaskBBError('Could not load topic data') return set([g.id for g in current_forum.groups]) & set([g.id for g in user.groups])