Beispiel #1
0
 def read(self, request, containerid=None, serviceid=None,
             mfileid=None, authid=None):
     if containerid or serviceid or mfileid:
         base = NamedBase.objects.get(
                 id__in=[containerid, serviceid, mfileid])
         result = {}
         result["usages"] = base.get_real_base().get_usage_summary()
         result["reportnum"] = base.reportnum
         return result
     elif authid:
         auth = Auth.objects.get(pk=authid)
         base = utils.get_base_for_auth(auth)
         result = {}
         result["usages"] = base.get_real_base().get_usage_summary()
         result["reportnum"] = base.reportnum
         return result
     elif request.user.is_staff:
         result = {}
         result["usages"] = Usage.get_full_usagesummary()
         result["reportnum"] = -1
         return result
     else:
         response = rc.BAD_REQUEST
         response.write("Invalid Request!")
         return response
Beispiel #2
0
def render_service_auth(request, auth):
    """Render the service auth page"""
    base = utils.get_base_for_auth(auth)
    form = MFileForm()
    form.fields['sid'].initial = base.id
    
    _dict = {}
    _dict["auth"] = auth
    _dict["usagesummary"] = auth.get_usage_summary()
    _dict["service"] = DataService.objects.get(id=base.id)
    _dict["form"] = form
    
    return render_to_response('auths/service_auth.html', \
        append_dict(_dict, request),\
        context_instance=RequestContext(request))