code: def default_permission_factory(query_name, params):
      
      from invenio_stats import current_stats
      if current_stats.queries[query_name].permission_factory is None:
          return AllowAllPermission
      else:
          return current_stats.queries[query_name].permission_factory(
              query_name, params
          )
docs: Default permission factory.
  
      It enables by default the statistics if they don't have a dedicated
      permission factory.