def check_datasource_perms(self, datasource_type=None, datasource_id=None):
    """
    Check if user can access a cached response from explore_json.

    This function takes `self` since it must have the same signature as the
    the decorated method.

    """
    form_data = get_form_data()[0]
    datasource_id, datasource_type = get_datasource_info(
        datasource_id, datasource_type, form_data)
    viz_obj = get_viz(
        datasource_type=datasource_type,
        datasource_id=datasource_id,
        form_data=form_data,
        force=False,
    )
    security_manager.assert_datasource_permission(viz_obj.datasource)
Check if user can access a cached response from explore_json.

    This function takes `self` since it must have the same signature as the
    the decorated method.