Ejemplo n.º 1
0
def _RenderUserListTemplate():
  """Render a list of users."""
  users = User.GetAll()
  user_payloads = _GenerateUserPayload(users)
  template_values = {
      'user_payloads': user_payloads
  }
  template = JINJA_ENVIRONMENT.get_template('templates/user.html')
  return template.render(template_values)
def _MakeKeyString():
    """Generate the key string in open ssh format for pushing to proxy servers.

  This key string includes only the public key for each user in order to grant
  the user access to each proxy server.

  Returns:
    key_string: A string of users with associated key.
  """
    users = User.GetAll()
    key_string = ''
    ssh_starting_portion = 'ssh-rsa'
    space = ' '
    endline = '\n'
    for user in users:
        if not user.is_key_revoked:
            user_string = (ssh_starting_portion + space + user.public_key +
                           space + user.email + endline)
            key_string += user_string

    return key_string