X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/bdd74e4dff9d9c5c1a329cfbed2e2e08336c8c51..e39da1ce43d8e695290a50493dc0f7b3c8a739c1:/lib/controller/localdb/collection.go diff --git a/lib/controller/localdb/collection.go b/lib/controller/localdb/collection.go index 529310519a..96c89252ec 100644 --- a/lib/controller/localdb/collection.go +++ b/lib/controller/localdb/collection.go @@ -48,8 +48,50 @@ func (conn *Conn) CollectionList(ctx context.Context, opts arvados.ListOptions) return resp, nil } +// CollectionCreate defers to railsProxy for everything except blob +// signatures and vocabulary checking. +func (conn *Conn) CollectionCreate(ctx context.Context, opts arvados.CreateOptions) (arvados.Collection, error) { + err := conn.checkProperties(ctx, opts.Attrs["properties"]) + if err != nil { + return arvados.Collection{}, err + } + if len(opts.Select) > 0 { + // We need to know IsTrashed and TrashAt to implement + // signing properly, even if the caller doesn't want + // them. + opts.Select = append([]string{"is_trashed", "trash_at"}, opts.Select...) + } + resp, err := conn.railsProxy.CollectionCreate(ctx, opts) + if err != nil { + return resp, err + } + conn.signCollection(ctx, &resp) + return resp, nil +} + +// CollectionUpdate defers to railsProxy for everything except blob +// signatures and vocabulary checking. +func (conn *Conn) CollectionUpdate(ctx context.Context, opts arvados.UpdateOptions) (arvados.Collection, error) { + err := conn.checkProperties(ctx, opts.Attrs["properties"]) + if err != nil { + return arvados.Collection{}, err + } + if len(opts.Select) > 0 { + // We need to know IsTrashed and TrashAt to implement + // signing properly, even if the caller doesn't want + // them. + opts.Select = append([]string{"is_trashed", "trash_at"}, opts.Select...) + } + resp, err := conn.railsProxy.CollectionUpdate(ctx, opts) + if err != nil { + return resp, err + } + conn.signCollection(ctx, &resp) + return resp, nil +} + func (conn *Conn) signCollection(ctx context.Context, coll *arvados.Collection) { - if coll.IsTrashed || coll.ManifestText == "" { + if coll.IsTrashed || coll.ManifestText == "" || !conn.cluster.Collections.BlobSigning { return } var token string