import jingrow
from jingrow.query_builder.functions import Count
from jingrow.query_builder.terms import QueryBuilder


def check(base_query: QueryBuilder) -> bool:
	JcloudeRole = jingrow.qb.PageType("Jcloude Role")
	return (
		base_query.where(JcloudeRole.allow_apps == 1)
		.select(Count(JcloudeRole.name).as_("count"))
		.run(as_dict=True)
		.pop()
		.get("count")
		> 0
	)
