def user_can_access_app(self, user, app):
        user_id = user['_id']
        app_id = app['_id']
        if not self.restrict or user['doc_type'] == 'WebUser':
            return True
        app_group = None
        for app_group in self.app_groups:
            if (app_id, app['copy_of'] or ()) in app_group.app_id:
                break
        if app_group:
            return Group.user_in_group(user_id, app_group.group_id)
        else:
            return False
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/cloudcare/models.py/ApplicationAccess.user_can_access_app/swapped operands of `in`