def BuildToken(request, execution_time):
 token = access_control.ACLToken(username=request.user, reason=request.REQ.get('reason', ''), process='GRRAdminUI', expiry=(rdfvalue.RDFDatetime.Now() + execution_time))
 for field in ['REMOTE_ADDR', 'HTTP_X_FORWARDED_FOR']:
  remote_addr = request.META.get(field, '')
  if remote_addr:
   token.source_ips.append(remote_addr)
 return token

def BuildToken ( request , execution_time ) : token = access_control . ACLToken ( username = request . user , reason = request . REQ . get ( 'reason' , '' ) , process = 'GRRAdminUI' , expiry = ( rdfvalue . RDFDatetime . Now ( ) + execution_time ) ) for field in [ 'REMOTE_ADDR' , 'HTTP_X_FORWARDED_FOR' ] : remote_addr = request . META . get ( field , '' ) if remote_addr : token . source_ips . append ( remote_addr ) return token
build an acltoken from the request .