Add primary auth method ID to default output fields, fix display bug (#1441)

pull/1445/head
Jeff Mitchell 5 years ago committed by GitHub
parent 6b578c0e30
commit e3012afb4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,7 +30,7 @@ const (
GrantScopeIdField = "grant_scope_id"
GrantsField = "grants"
GrantStringsField = "grant_strings"
PrimaryAuthMethodId = "primary_auth_method_id"
PrimaryAuthMethodIdField = "primary_auth_method_id"
TargetIdField = "target_id"
HostIdField = "host_id"
HostSetIdField = "host_set_id"

@ -150,7 +150,7 @@ func printItemTable(result api.GenericResult) string {
nonAttributeMap["Description"] = item.Description
}
if item.PrimaryAuthMethodId != "" {
nonAttributeMap[flagPrimaryAuthMethodIdName] = item.PrimaryAuthMethodId
nonAttributeMap["Primary Auth Method ID"] = item.PrimaryAuthMethodId
}
maxLength := base.MaxAttributesLength(nonAttributeMap, nil, nil)

@ -75,6 +75,7 @@ func (o OutputFieldsMap) SelfOrDefaults(userId string) OutputFieldsMap {
globals.DescriptionField: true,
globals.TypeField: true,
globals.IsPrimaryField: true,
globals.PrimaryAuthMethodIdField: true,
globals.AuthorizedActionsField: true,
globals.AuthorizedCollectionActionsField: true,
}

@ -248,6 +248,7 @@ func Test_ACLSelfOrDefault(t *testing.T) {
globals.DescriptionField: true,
globals.TypeField: true,
globals.IsPrimaryField: true,
globals.PrimaryAuthMethodIdField: true,
globals.AuthorizedActionsField: true,
globals.AuthorizedCollectionActionsField: true,
},

@ -578,7 +578,7 @@ func ToProto(ctx context.Context, in *iam.Scope, opt ...handlers.Option) (*pb.Sc
if outputFields.Has(globals.AuthorizedCollectionActionsField) {
out.AuthorizedCollectionActions = opts.WithAuthorizedCollectionActions
}
if outputFields.Has(globals.PrimaryAuthMethodId) && in.GetPrimaryAuthMethodId() != "" {
if outputFields.Has(globals.PrimaryAuthMethodIdField) && in.GetPrimaryAuthMethodId() != "" {
out.PrimaryAuthMethodId = &wrapperspb.StringValue{Value: in.GetPrimaryAuthMethodId()}
}

Loading…
Cancel
Save