Beispiel #1
0
  def GetFlow(self, args, token=None):
    if not self.params.get_flow.enabled:
      raise access_control.UnauthorizedAccess(
          "GetFlow is not allowed by the configuration.")

    self._CheckFlowRobotId(args.client_id, args.flow_id, token=token)

    return api_flow.ApiGetFlowHandler()
Beispiel #2
0
    def testNestedFlowsAppearCorrectlyAfterAutoRefresh(self):
        self.Open("/#/clients/%s" % self.client_id)
        # Ensure auto-refresh updates happen every second.
        self.GetJavaScriptValue(
            "grrUi.flow.flowsListDirective.setAutoRefreshInterval(1000);")

        flow_1 = flow.GRRFlow.StartFlow(
            client_id=self.client_id,
            flow_name=gui_test_lib.FlowWithOneLogStatement.__name__,
            token=self.token)

        # Go to the flows page without refreshing the page, so that
        # AUTO_REFRESH_INTERVAL_MS setting is not reset and wait
        # until flow_1 is visible.
        self.Click("css=a[grrtarget='client.flows']")
        self.WaitUntil(self.IsElementPresent,
                       "css=tr:contains('%s')" % flow_1.Basename())

        # Create a recursive flow_2 that will appear after auto-refresh.
        flow_2 = flow.GRRFlow.StartFlow(
            client_id=self.client_id,
            flow_name=gui_test_lib.RecursiveTestFlow.__name__,
            token=self.token)

        # Check that the flow we started in the background appears in the list.
        self.WaitUntil(self.IsElementPresent,
                       "css=tr:contains('%s')" % flow_2.Basename())

        # Check that flow_2 is the row 1 (row 0 is the table header).
        self.WaitUntil(
            self.IsElementPresent,
            "css=grr-client-flows-list tr:nth(1):contains('%s')" %
            flow_2.Basename())

        # Click on a nested flow.
        self.Click("css=tr:contains('%s') span.tree_branch" %
                   flow_2.Basename())

        # Check that flow_2 is still row 1 and that nested flows occupy next
        # rows.
        self.WaitUntil(
            self.IsElementPresent,
            "css=grr-client-flows-list tr:nth(1):contains('%s')" %
            flow_2.Basename())

        flow_data = api_flow.ApiGetFlowHandler().Handle(
            api_flow.ApiGetFlowArgs(client_id=self.client_id,
                                    flow_id=flow_2.Basename()),
            token=self.token)

        for index, nested_flow in enumerate(flow_data.nested_flows):
            self.WaitUntil(
                self.IsElementPresent,
                "css=grr-client-flows-list tr:nth(%d):contains('%s')" %
                (index + 2, nested_flow.flow_id))
Beispiel #3
0
 def Handle(self, args, token=None):
   return api_flow.ApiGetFlowHandler().Handle(
       api_flow.ApiGetFlowArgs(
           client_id=args.client_id, flow_id=self.flow_urn.Basename()),
       token=token)
 def GetFlow(self, args, token=None):
     return api_flow.ApiGetFlowHandler()