This view returns the index configuration of the current
    application as JSON.  Currently, this consists of a Solr index url
    and the Fedora content models that this application expects to index.

    .. Note::

       By default, Fedora system content models (such as
       ``fedora-system:ContentModel-3.0``) are excluded.  Any
       application that actually wants to index such objects will need
       to customize this view to include them.

def index_config(request):
    '''This view returns the index configuration of the current
    application as JSON.  Currently, this consists of a Solr index url
    and the Fedora content models that this application expects to index.

    .. Note::

       By default, Fedora system content models (such as
       ``fedora-system:ContentModel-3.0``) are excluded.  Any
       application that actually wants to index such objects will need
       to customize this view to include them.
    '''
    #Ensure permission to this resource is allowed. Currently based on IP only.
    if _permission_denied_check(request):
        return HttpResponseForbidden('Access to this web service was denied.', content_type='text/html')

    content_list = getattr(settings, 'EUL_INDEXER_CONTENT_MODELS', [])

    # Generate an automatic list of lists of content models (one list for each defined type)
    # if no content model settings exist
    if not content_list:
        for cls in six.itervalues(DigitalObject.defined_types):
            # by default, Fedora system content models are excluded
            content_group = [model for model in getattr(cls, 'CONTENT_MODELS', [])
                             if not model.startswith('info:fedora/fedora-system:')]
            # if the group of content models is not empty, add it to the list
            if content_group:
                content_list.append(content_group)

    response = {
        'CONTENT_MODELS': content_list,
        'SOLR_URL': settings.SOLR_SERVER_URL
    }

    return HttpResponse(json.dumps(response), content_type='application/json')