[#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 5 additions and 6 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

BIN
go.sum

Binary file not shown.

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
} }
} }