@@ -0,0 +1,1075 @@
+from .allows import Allows%0Afrom .requirements import Requirement%0Afrom flask import current_app as app%0Afrom flask import g%0A%0A%0Aallows = Allows(identity_loader=lambda: g.user)%0A%0A%0Adef is_staff(identity, request):%0A    pass%0A%0A%0Aclass CanAccessBucket(Requirement):%0A    %22%22%22docstring for CanAccessBucket%22%22%22%0A%0A    def __init__(self, arg):%0A        super(CanAccessBucket, self).__init__()%0A        self.arg = arg%0A%0A    def fulfill(self, identity, request):%0A        forum_id = self.determine_forum_id(request)%0A        user_group_ids = self.get_user_group_ids(user)%0A%0A        q = Forum.query.with_entities(Forum.id).filter(%0A            Forum.id == forum_id, Forum.groups.any(%0A                Group.id.in_(user_group_ids))%0A        ).first()%0A%0A        return q is not None%0A%0A    def determine_forum(self, request):%0A        # do something complicated to determine the forum_id%0A        return request.view_args%5B'forum_id'%5D%0A%0A    def user_group_ids(self, user):%0A        if user.is_anonymous():%0A            return %5BGroup.get_guest_group().id%5D%0A        else:%0A            return %5Bgr.id for gr in user.groups%5D%0A

Update app/extensions/allows/identities.py