@classmethod<EOL><INDENT>def query_requests(cls, admin, eager=False):<DEDENT>
<EOL>if hasattr(admin, '<STR_LIT>') and admin.is_superadmin:<EOL><INDENT>q1 = GroupAdmin.query.with_entities(<EOL>GroupAdmin.group_id)<EOL><DEDENT>else:<EOL><INDENT>q1 = GroupAdmin.query_by_admin(admin).with_entities(<EOL>GroupAdmin.group_id)<EOL><DEDENT>q2 = Membership.query.filter(<EOL>Membership.state == MembershipState.PENDING_ADMIN,<EOL>Membership.id_group.in_(q1),<EOL>)<EOL>q3 = Membership.query_by_user(<EOL>user=admin, state=MembershipState.ACTIVE<EOL>).with_entities(Membership.id_group)<EOL>q4 = GroupAdmin.query.filter(<EOL>GroupAdmin.admin_type == '<STR_LIT>', GroupAdmin.admin_id.in_(q3)<EOL>).with_entities(GroupAdmin.group_id)<EOL>q5 = Membership.query.filter(<EOL>Membership.state == MembershipState.PENDING_ADMIN,<EOL>Membership.id_group.in_(q4))<EOL>query = q2.union(q5)<EOL>return query<EOL>
Get all pending group requests.