[#1377] oid, cid: Upgrade SDK package

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-05-12 19:37:46 +03:00 committed by LeL
parent f65898a354
commit f15e6e888f
118 changed files with 1455 additions and 886 deletions

View file

@ -137,14 +137,14 @@ func checkTokenContext(tok *session.Token, verbAssert verbAssert) error {
return err
}
func checkTokenContextWithCID(tok *session.Token, id *cid.ID, verbAssert verbAssert) error {
func checkTokenContextWithCID(tok *session.Token, id cid.ID, verbAssert verbAssert) error {
c, err := contextWithVerifiedVerb(tok, verbAssert)
if err != nil {
return err
}
tokCID := c.Container()
if tokCID != nil && !tokCID.Equal(id) {
if tokCID != nil && !tokCID.Equals(id) {
return errWrongCID
}

View file

@ -8,7 +8,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neo-go/pkg/network/payload"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/nspcc-dev/neofs-node/pkg/core/container"
cntClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid"
@ -192,10 +191,12 @@ func (cp *Processor) checkDeleteContainer(e *containerEvent.Delete) error {
if token != nil {
// check token context
// TODO: #1147 think how to avoid version casts
idV2 := new(refs.ContainerID)
idV2.SetValue(binCID)
var id cid.ID
id := cid.NewFromV2(idV2)
err = id.Decode(binCID)
if err != nil {
return fmt.Errorf("decode container ID: %w", err)
}
err = checkTokenContextWithCID(token, id, func(c *session.ContainerContext) bool {
return c.IsForDelete()

View file

@ -56,8 +56,13 @@ func (cp *Processor) checkSetEACL(e container.SetEACL) error {
return fmt.Errorf("invalid binary table: %w", err)
}
idCnr, ok := table.CID()
if !ok {
return errors.New("missing container ID in eACL table")
}
// receive owner of the related container
cnr, err := cntClient.Get(cp.cnrClient, table.CID())
cnr, err := cntClient.Get(cp.cnrClient, &idCnr)
if err != nil {
return fmt.Errorf("could not receive the container: %w", err)
}
@ -70,7 +75,7 @@ func (cp *Processor) checkSetEACL(e container.SetEACL) error {
if tok != nil {
// check token context
err = checkTokenContextWithCID(tok, table.CID(), func(c *session.ContainerContext) bool {
err = checkTokenContextWithCID(tok, idCnr, func(c *session.ContainerContext) bool {
return c.IsForSetEACL()
})
if err != nil {