From d94a0eb25e5c43c0fb0c8e57bd7c15fcab0d8fff Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 1 Dec 2020 10:35:01 +0300 Subject: [PATCH] [#221] eacl: Get rid of deprecated methods usage Signed-off-by: Leonard Lyubich --- go.mod | 2 +- go.sum | 4 ++-- pkg/services/object/acl/eacl/v2/eacl_test.go | 4 ++-- pkg/services/object/acl/eacl/validator.go | 5 ++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 415b746d7..5fcdbf384 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/multiformats/go-multiaddr-net v0.1.2 // v0.1.1 => v0.1.2 github.com/multiformats/go-multihash v0.0.13 // indirect github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201030072836-71216865717b - github.com/nspcc-dev/neofs-api-go v1.20.3-0.20201126102634-2a94fdc5e709 + github.com/nspcc-dev/neofs-api-go v1.20.3-0.20201201071132-c01024b5531a github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/tzhash v1.4.0 github.com/panjf2000/ants/v2 v2.3.0 diff --git a/go.sum b/go.sum index 97caf4843..b88742fd6 100644 --- a/go.sum +++ b/go.sum @@ -276,8 +276,8 @@ github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1: github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201030072836-71216865717b h1:gk5bZgpWOehaDVKI5vBDkcjXTpRkKqcvIb1h/vHnBH4= github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201030072836-71216865717b/go.mod h1:9s7LNp2lMgf0caH2t0sam4+WT2SIauXozwP0AdBqnEo= -github.com/nspcc-dev/neofs-api-go v1.20.3-0.20201126102634-2a94fdc5e709 h1:t5kNkoT/SR6483xA72L3yeOxcxXNmqDE9cZtpqEFTOM= -github.com/nspcc-dev/neofs-api-go v1.20.3-0.20201126102634-2a94fdc5e709/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= +github.com/nspcc-dev/neofs-api-go v1.20.3-0.20201201071132-c01024b5531a h1:9FZECHlRgrzTRLBj1PiA0NkKMv4+bq09/1/5ZS6xZUM= +github.com/nspcc-dev/neofs-api-go v1.20.3-0.20201201071132-c01024b5531a/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= diff --git a/pkg/services/object/acl/eacl/v2/eacl_test.go b/pkg/services/object/acl/eacl/v2/eacl_test.go index 0c6f9ff3f..0a4721485 100644 --- a/pkg/services/object/acl/eacl/v2/eacl_test.go +++ b/pkg/services/object/acl/eacl/v2/eacl_test.go @@ -124,12 +124,12 @@ func TestHeadRequest(t *testing.T) { senderKey := test.DecodeKey(-1).PublicKey - r := new(eacl.Record) + r := eacl.NewRecord() r.SetOperation(eacl.OperationHead) r.SetAction(eacl.ActionDeny) r.AddFilter(eacl.HeaderFromObject, eacl.MatchStringEqual, attrKey, attrVal) r.AddFilter(eacl.HeaderFromRequest, eacl.MatchStringEqual, xKey, xVal) - r.AddTarget(eacl.RoleUnknown, senderKey) + eacl.AddFormedTarget(r, eacl.RoleUnknown, senderKey) table.AddRecord(r) diff --git a/pkg/services/object/acl/eacl/validator.go b/pkg/services/object/acl/eacl/validator.go index 8939f06a8..212433204 100644 --- a/pkg/services/object/acl/eacl/validator.go +++ b/pkg/services/object/acl/eacl/validator.go @@ -5,7 +5,6 @@ import ( "errors" "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/pkg/core/container" "github.com/nspcc-dev/neofs-node/pkg/util/logger" "go.uber.org/zap" @@ -160,8 +159,8 @@ func matchFilters(hdrSrc TypedHeaderSource, filters []*eacl.Filter) int { func targetMatches(unit *ValidationUnit, record *eacl.Record) bool { for _, target := range record.Targets() { // check public key match - for _, key := range target.Keys() { - if bytes.Equal(crypto.MarshalPublicKey(&key), unit.key) { + for _, key := range target.BinaryKeys() { + if bytes.Equal(key, unit.key) { return true } }