[#221] eacl: Get rid of deprecated methods usage

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-12-01 10:35:01 +03:00 committed by Leonard Lyubich
parent 4c0ca23b34
commit d94a0eb25e
4 changed files with 7 additions and 8 deletions

2
go.mod
View file

@ -14,7 +14,7 @@ require (
github.com/multiformats/go-multiaddr-net v0.1.2 // v0.1.1 => v0.1.2 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/multiformats/go-multihash v0.0.13 // indirect
github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201030072836-71216865717b 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/neofs-crypto v0.3.0
github.com/nspcc-dev/tzhash v1.4.0 github.com/nspcc-dev/tzhash v1.4.0
github.com/panjf2000/ants/v2 v2.3.0 github.com/panjf2000/ants/v2 v2.3.0

4
go.sum
View file

@ -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.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 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/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.20201201071132-c01024b5531a h1:9FZECHlRgrzTRLBj1PiA0NkKMv4+bq09/1/5ZS6xZUM=
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/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.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.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw=
github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM=

View file

@ -124,12 +124,12 @@ func TestHeadRequest(t *testing.T) {
senderKey := test.DecodeKey(-1).PublicKey senderKey := test.DecodeKey(-1).PublicKey
r := new(eacl.Record) r := eacl.NewRecord()
r.SetOperation(eacl.OperationHead) r.SetOperation(eacl.OperationHead)
r.SetAction(eacl.ActionDeny) r.SetAction(eacl.ActionDeny)
r.AddFilter(eacl.HeaderFromObject, eacl.MatchStringEqual, attrKey, attrVal) r.AddFilter(eacl.HeaderFromObject, eacl.MatchStringEqual, attrKey, attrVal)
r.AddFilter(eacl.HeaderFromRequest, eacl.MatchStringEqual, xKey, xVal) r.AddFilter(eacl.HeaderFromRequest, eacl.MatchStringEqual, xKey, xVal)
r.AddTarget(eacl.RoleUnknown, senderKey) eacl.AddFormedTarget(r, eacl.RoleUnknown, senderKey)
table.AddRecord(r) table.AddRecord(r)

View file

@ -5,7 +5,6 @@ import (
"errors" "errors"
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "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/core/container"
"github.com/nspcc-dev/neofs-node/pkg/util/logger" "github.com/nspcc-dev/neofs-node/pkg/util/logger"
"go.uber.org/zap" "go.uber.org/zap"
@ -160,8 +159,8 @@ func matchFilters(hdrSrc TypedHeaderSource, filters []*eacl.Filter) int {
func targetMatches(unit *ValidationUnit, record *eacl.Record) bool { func targetMatches(unit *ValidationUnit, record *eacl.Record) bool {
for _, target := range record.Targets() { for _, target := range record.Targets() {
// check public key match // check public key match
for _, key := range target.Keys() { for _, key := range target.BinaryKeys() {
if bytes.Equal(crypto.MarshalPublicKey(&key), unit.key) { if bytes.Equal(key, unit.key) {
return true return true
} }
} }