diff --git a/internal/servers/controller/handlers/host_catalogs/host_catalog_service.go b/internal/servers/controller/handlers/host_catalogs/host_catalog_service.go index 97e59b491..16f6e2a61 100644 --- a/internal/servers/controller/handlers/host_catalogs/host_catalog_service.go +++ b/internal/servers/controller/handlers/host_catalogs/host_catalog_service.go @@ -354,13 +354,21 @@ func (s Service) UpdateHostCatalog(ctx context.Context, req *pbs.UpdateHostCatal outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hc.GetPublicId(), IdActions).Strings())) } if outputFields.Has(globals.AuthorizedCollectionActionsField) { - collectionActions, err := auth.CalculateAuthorizedCollectionActions(ctx, authResults, collectionTypeMap[static.Subtype], authResults.Scope.Id, hc.GetPublicId()) - if err != nil { - return nil, err + var subtype subtypes.Subtype + switch hc.(type) { + case *static.HostCatalog: + subtype = static.Subtype + case *plugin.HostCatalog: + subtype = plugin.Subtype + } + if subtype != "" { + collectionActions, err := auth.CalculateAuthorizedCollectionActions(ctx, authResults, collectionTypeMap[subtype], authResults.Scope.Id, hc.GetPublicId()) + if err != nil { + return nil, err + } + outputOpts = append(outputOpts, handlers.WithAuthorizedCollectionActions(collectionActions)) } - outputOpts = append(outputOpts, handlers.WithAuthorizedCollectionActions(collectionActions)) } - item, err := toProto(ctx, hc, outputOpts...) if err != nil { return nil, err diff --git a/internal/servers/controller/handlers/host_catalogs/host_catalog_service_test.go b/internal/servers/controller/handlers/host_catalogs/host_catalog_service_test.go index 20e1f6d72..01eafbe62 100644 --- a/internal/servers/controller/handlers/host_catalogs/host_catalog_service_test.go +++ b/internal/servers/controller/handlers/host_catalogs/host_catalog_service_test.go @@ -1448,6 +1448,7 @@ func TestUpdate_Plugin(t *testing.T) { check: func(t *testing.T, in *pb.HostCatalog) { assert.Equal(t, "new", in.Name.GetValue()) assert.Equal(t, "desc", in.Description.GetValue()) + assert.Equal(t, authorizedCollectionActions[plugin.Subtype], in.GetAuthorizedCollectionActions()) }, }, {