def Layout(self, request, response):
    self.acl = request.REQ.get("acl")

    source = request.REQ.get("source")

    if self.acl is None and source != "hash":
      # NOTE: we have to pass id explicitly because super().Layout() wasn't
      # called yet, and therefore self.id is None.
      return self.CallJavascript(response, "GrantAccess.RefreshFromHash",
                                 renderer=self.__class__.__name__,
                                 id=request.REQ.get("id", hash(self)))

    # There is a bug in Firefox that strips trailing "="s from get parameters
    # which is a problem with the base64 padding. To pass the selenium tests,
    # we have to restore the original string.
    while len(self.acl.split("/")[-1]) % 4 != 0:
      self.acl += "="

    # TODO(user): This makes assumptions about the approval URL.
    approval_urn = rdfvalue.RDFURN(self.acl or "/")
    components = approval_urn.Split()
    username = components[-2]
    namespace = components[1]

    _, namespace, _ = approval_urn.Split(3)
    if namespace == "hunts":
      self.details_renderer = "HuntApprovalDetailsRenderer"
      self.user = components[3]
      self.detail_header = "Hunt Information"
    elif namespace == "cron":
      self.details_renderer = "CronJobApprovalDetailsRenderer"
      self.user = components[3]
      self.detail_header = "Cronjob Information"
    elif aff4.AFF4Object.VFSGRRClient.CLIENT_ID_RE.match(namespace):
      self.details_renderer = "ClientApprovalDetailsRenderer"
      self.user = components[2]
      self.detail_header = "Client Information"
    else:
      raise access_control.UnauthorizedAccess(
          "Approval object is not well formed.")

    approval_request = aff4.FACTORY.Open(approval_urn, mode="r",
                                         age=aff4.ALL_TIMES,
                                         token=request.token)
    self.user = username
    self.reason = approval_request.Get(approval_request.Schema.REASON)

    user_token = access_control.ACLToken(username=self.user, reason=self.reason)
    self.already_approved_text = ""
    self.btn_cls = "btn btn-success"
    try:
      if approval_request.CheckAccess(user_token):
        self.already_approved_text = "This approval has already been granted!"
        self.btn_cls = "btn btn-warning"
    except access_control.UnauthorizedAccess:
      pass

    response = renderers.TemplateRenderer.Layout(self, request, response)
    return self.CallJavascript(response, "GrantAccess.Layout",
                               renderer=self.__class__.__name__,
                               acl=self.acl,
                               details_renderer=self.details_renderer)
Launch the RequestApproval flow on the backend.
dataset/ETHPy150Open google/grr/grr/gui/plugins/acl_manager.py/GrantAccess.Layout