def can_view_app(req, dom):
    if not dom or not dom.is_snapshot or not dom.published:
        return False
    if not dom.is_approved and (
        not getattr(req, "couch_user", "") or not req.couch_user.is_domain_admin(dom.copied_from.name)
    ):
        return False
    return True
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/appstore/views.py/can_view_app/original