Esempio n. 1
0
def allgateways(request):
    '''
    View to look at all AG's in a tabular format, with owners and attached volumes.
    '''
    session = request.session
    username = session['login_email']

    # Get gateways
    try:
        qry = db.list_acquisition_gateways()
    except:
        qry = []
    gateways = []
    for g in qry:
        gateways.append(g)

    # Get volumes and owners
    vols = []
    g_owners = []
    for g in gateways:
        volset = []
        for v in g.volume_ids:
            volset.append(db.read_volume(v))
        vols.append(volset)
        attrs = {"SyndicateUser.owner_id ==": g.owner_id}
        g_owners.append(db.get_user(attrs))

    gateway_vols_owners = zip(gateways, vols, g_owners)
    t = loader.get_template('gateway_templates/allacquisitiongateways.html')
    c = RequestContext(request, {
        'username': username,
        'gateway_vols_owners': gateway_vols_owners
    })
    return HttpResponse(t.render(c))
Esempio n. 2
0
def allgateways(request):
    '''
    View to look at all AG's in a tabular format, with owners and attached volumes.
    '''
    session = request.session
    username = session['login_email']

    # Get gateways
    try:
        qry = db.list_acquisition_gateways()
    except:
        qry = []
    gateways = []
    for g in qry:
        gateways.append(g)

    # Get volumes and owners
    vols = []
    g_owners = []
    for g in gateways:
        volset = []
        for v in g.volume_ids:
            volset.append(db.read_volume(v))
        vols.append(volset)
        attrs = {"SyndicateUser.owner_id ==":g.owner_id}
        g_owners.append(db.get_user(attrs))


    gateway_vols_owners = zip(gateways, vols, g_owners)
    t = loader.get_template('gateway_templates/allacquisitiongateways.html')
    c = RequestContext(request, {'username':username, 'gateway_vols_owners':gateway_vols_owners})
    return HttpResponse(t.render(c))
Esempio n. 3
0
def urldelete(request, g_name, g_password):
    '''
    For debugging purposes only, allows deletion of AG via pure URL
    '''
    session = request.session
    username = session['login_email']

    attrs = {"AcquisitionGateway.ms_username ==": g_name}
    ags = db.list_acquisition_gateways(attrs, limit=1)
    if ags:
        ag = ags[0]
    else:
        return HttpResponse("AG %s does not exist." % g_name)
    if not AG.authenticate(ag, g_password):
        return HttpResponse("Incorrect AG password.")
    db.delete_acquisition_gateway(g_name)
    return HttpResponse("Gateway succesfully deleted.")
Esempio n. 4
0
def urldelete(request, g_name, g_password):
    '''
    For debugging purposes only, allows deletion of AG via pure URL
    '''
    session = request.session
    username = session['login_email']

    attrs = {"AcquisitionGateway.ms_username ==":g_name}
    ags = db.list_acquisition_gateways(attrs, limit=1)
    if ags:
        ag = ags[0]
    else:
        return HttpResponse("AG %s does not exist." % g_name)
    if not AG.authenticate(ag, g_password):
        return HttpResponse("Incorrect AG password.")
    db.delete_acquisition_gateway(g_name)
    return HttpResponse("Gateway succesfully deleted.")