def ApprovalGrant(token=None):
 user = getpass.getuser()
 notifications = GetNotifications(user=user, token=token)
 requests = [n for n in notifications if (n.type == 'GrantAccess')]
 for request in requests:
  (_, client_id, user, reason) = rdfvalue.RDFURN(request.subject).Split()
  reason = utils.DecodeReasonString(reason)
  print request
  print ('Reason: %s' % reason)
  if (raw_input('Do you approve this request? [y/N] ').lower() == 'y'):
   flow_id = flow.GRRFlow.StartFlow(client_id=client_id, flow_name='GrantClientApprovalFlow', reason=reason, delegate=user, token=token)
  else:
   print 'skipping request'
  print ('Approval sent: %s' % flow_id)

def ApprovalGrant ( token = None ) : user = getpass . getuser ( ) notifications = GetNotifications ( user = user , token = token ) requests = [ n for n in notifications if ( n . type == 'GrantAccess' ) ] for request in requests : ( _ , client_id , user , reason ) = rdfvalue . RDFURN ( request . subject ) . Split ( ) reason = utils . DecodeReasonString ( reason ) print request print ( 'Reason: %s' % reason ) if ( raw_input ( 'Do you approve this request? [y/N] ' ) . lower ( ) == 'y' ) : flow_id = flow . GRRFlow . StartFlow ( client_id = client_id , flow_name = 'GrantClientApprovalFlow' , reason = reason , delegate = user , token = token ) else : print 'skipping request' print ( 'Approval sent: %s' % flow_id )
iterate through requested access approving or not .