Update allowed formats of ACL strings (#508)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-10-01 01:49:20 -04:00
1 parent 4854f2c35f
commit 6ddfe407a3
20 files changed
+221 -133

No files matched your search

+1 -1
View File
@@ -132,7 +132,7 @@ func (b *Server) CreateInitialAuthMethod(ctx context.Context) (*password.AuthMet
if err != nil {
return nil, nil, fmt.Errorf("error creating role for default generated grants: %w", err)
}
if _, err := iamRepo.AddRoleGrants(cancelCtx, defPermsRole.PublicId, defPermsRole.Version, []string{"id=*;actions=*"}); err != nil {
if _, err := iamRepo.AddRoleGrants(cancelCtx, defPermsRole.PublicId, defPermsRole.Version, []string{"id=*;type=*;actions=*"}); err != nil {
return nil, nil, fmt.Errorf("error creating grant for default generated grants: %w", err)
}
if _, err := iamRepo.AddPrincipalRoles(cancelCtx, defPermsRole.PublicId, defPermsRole.Version+1, []string{u.GetPublicId()}, nil); err != nil {
@@ -10,6 +10,7 @@ import (
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/api/authmethods"
"github.com/hashicorp/boundary/api/authtokens"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/hashicorp/vault/sdk/helper/password"
"github.com/mitchellh/cli"
@@ -135,7 +136,7 @@ func (c *PasswordCommand) Run(args []string) int {
return 2
}
token := result.Item
token := result.GetItem().(*authtokens.AuthToken)
switch base.Format(c.UI) {
case "table":
c.UI.Output(base.WrapForHelpText([]string{
@@ -149,7 +150,7 @@ func (c *PasswordCommand) Run(args []string) int {
}))
case "json":
jsonOut, err := base.JsonFormatter{}.Format(result)
jsonOut, err := base.JsonFormatter{}.Format(token)
if err != nil {
c.UI.Error(fmt.Errorf("Error formatting as JSON: %w", err).Error())
return 1
+1 -1
View File
@@ -117,6 +117,7 @@ func generateRoleTableOutput(in *roles.Role) string {
if len(in.Principals) > 0 {
ret = append(ret,
"",
fmt.Sprintf(" Principals: %s", ""),
)
}
@@ -135,7 +136,6 @@ func generateRoleTableOutput(in *roles.Role) string {
}
for _, grant := range in.Grants {
ret = append(ret,
"",
fmt.Sprintf(" %s", grant.Canonical),
)
+1 -1
View File
@@ -182,7 +182,7 @@ func (c *Command) Run(args []string) int {
if len(grants) > 0 {
for _, grant := range grants {
_, err := perms.Parse("global", "", grant)
_, err := perms.Parse("global", "", grant, false)
if err != nil {
c.UI.Error(fmt.Errorf("Grant %q could not be parsed successfully: %w", grant, err).Error())
return 1