Ejemplo n.º 1
0
// Install the admin username and password, and initialize the security database and objects.
func instanceAdmin(ac *clients.AdminClient, username string, password string, realm string, response handle.ResponseHandle) error {
	params := "?"
	params = util.RepeatingParameters(params, "admin-username", []string{username})
	params = util.RepeatingParameters(params, "admin-password", []string{password})
	params = util.RepeatingParameters(params, "realm", []string{realm})
	req, err := util.BuildRequestFromHandle(ac, "POST", "/instance-admin"+params, nil)
	if err != nil {
		return err
	}
	return util.Execute(ac, req, response)
}
Ejemplo n.º 2
0
func buildParameters(uris []string, categories []string, collections []string, permissions map[string]string, properties map[string]string, transform *util.Transform) string {
	params := "?"
	params = util.RepeatingParameters(params, "uri", uris)
	params = util.RepeatingParameters(params, "category", categories)
	params = util.RepeatingParameters(params, "collection", collections)
	params = util.MappedParameters(params, "perm", permissions)
	params = util.MappedParameters(params, "prop", properties)
	if transform != nil {
		params = params + transform.ToParameters()
	}
	return params
}