Beispiel #1
0
def index(request):
    ff = Federation.objects.all().order_by('name')
    federations = []
    interfederations = []
    for f in ff:
        if f.is_interfederation:
            interfederations.append(f)
        else:
            federations.append(f)

    cc = Entity.objects.values('federations__id', 'types__xmlname').annotate(
        Count('federations__id'), Count('types__xmlname'))
    counts = {}
    for curtype in DESCRIPTOR_TYPES:
        counts[curtype] = []
        for c in cc:
            if c['types__xmlname'] == curtype:
                counts[curtype].append(c)
    counts['All'] = Entity.objects.values('federations__id').annotate(
        Count('federations__id'))

    totals = Entity.objects.values('types__xmlname').annotate(
        Count('types__xmlname'))

    # Entities with count how many federations belongs to, and sorted by most first
    current_top_length = request.session.get('currentTopLength', TOP_LENGTH)
    most_federated_entities = Entity.get_most_federated_entities(
        maxlength=current_top_length, cache_expire=24 * 60 * 60)

    params = {
        'settings': settings,
        'interfederations': interfederations,
        'federations': federations,
        'entity_types': DESCRIPTOR_TYPES,
        'federation_path': request.path,
        'counts': counts,
        'totals': totals,
        'most_federated_entities': most_federated_entities,
    }

    export = request.GET.get('export', None)
    export_format = request.GET.get('format', None)
    if export and export_format:
        return _index_export(export, export_format, params)

    return render_to_response('metadataparser/index.html',
                              params,
                              context_instance=RequestContext(request))
Beispiel #2
0
def most_federated_entities(request):
    # Entities with count how many federations belongs to, and sorted by most first
    current_top_length = request.session.get('currentTopLength', TOP_LENGTH)
    most_federated_entities = Entity.get_most_federated_entities(maxlength=current_top_length, cache_expire=24*60*60)

    params = {
       'settings': settings,
       'most_federated_entities': most_federated_entities,
    }

    export = request.GET.get('export', None)
    export_format = request.GET.get('format', None)
    if export and export_format:
        return _index_export(export, export_format, params)
    
    return render_to_response('metadataparser/most_federated_entities.html', params, context_instance=RequestContext(request))
Beispiel #3
0
def index(request):
    ff = Federation.objects.all().order_by('name')
    federations = []
    interfederations = []
    for f in ff:
        if f.is_interfederation:
            interfederations.append(f)
        else:
            federations.append(f)

    cc = Entity.objects.values('federations__id', 'types__xmlname').annotate(Count('federations__id'), Count('types__xmlname'))
    counts = {}
    for curtype in DESCRIPTOR_TYPES:
        counts[curtype] = []
        for c in cc:
            if c['types__xmlname'] == curtype:
                counts[curtype].append(c)
    counts['All'] = Entity.objects.values('federations__id').annotate(Count('federations__id'))

    totals = Entity.objects.values('types__xmlname').annotate(Count('types__xmlname'))

    # Entities with count how many federations belongs to, and sorted by most first
    current_top_length = request.session.get('currentTopLength', TOP_LENGTH)
    most_federated_entities = Entity.get_most_federated_entities(maxlength=current_top_length, cache_expire=24*60*60)

    params = {
       'settings': settings,
       'interfederations': interfederations,
       'federations': federations,
       'entity_types': DESCRIPTOR_TYPES,
       'federation_path': request.path,
       'counts': counts,
       'totals': totals,
       'most_federated_entities': most_federated_entities,
    }

    export = request.GET.get('export', None)
    export_format = request.GET.get('format', None)
    if export and export_format:
        return _index_export(export, export_format, params)
    
    return render_to_response('metadataparser/index.html', params, context_instance=RequestContext(request))
Beispiel #4
0
def index(request):
    federations = Federation.objects.filter(is_interfederation=False)

    interfederations = Federation.objects.filter(is_interfederation=True)

    # Entities with count how many federations belongs to, and sorted by most first
    most_federated_entities = Entity.get_most_federated_entities(cache_expire=(24 * 60 * 60))

    export = request.GET.get('export', None)
    format = request.GET.get('format', None)
    if export and format:
        counters = (
                    ('all', {}),
                    ('IDPSSO', {'types__xmlname': 'IDPSSODescriptor'}),
                    ('SPSSO', {'types__xmlname': 'SPSSODescriptor'}),
                   )
        if export == 'interfederations':
            return export_summary(request.GET.get('format'), interfederations,
                                  'entity_set', 'interfederations_summary',
                                  counters)

        elif export == 'federations':
            return export_summary(request.GET.get('format'), federations,
                                  'entity_set', 'federations_summary',
                                  counters)
        elif export == 'most_federated_entities':
            return export_query_set(request.GET.get('format'), most_federated_entities,
                                'most_federated_entities', ('', 'types', 'federations'))
        else:
            return HttpResponseBadRequest('Not valid export query')

    return render_to_response('metadataparser/index.html', {
           'interfederations': interfederations,
           'federations': federations,
           'entities': Entity.objects.all(),
           'entity_types': DESCRIPTOR_TYPES,
           'most_federated_entities': most_federated_entities,
           }, context_instance=RequestContext(request))