[#293] pkg/eacl: Implement generator of Record

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-06-08 11:22:58 +03:00 committed by Alex Vanin
parent 88a3829b39
commit f406463c34

View file

@ -2,6 +2,8 @@ package eacltest
import (
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test"
)
// Target returns random eacl.Target.
@ -16,3 +18,16 @@ func Target() *eacl.Target {
return x
}
// Record returns random eacl.Record.
func Record() *eacl.Record {
x := eacl.NewRecord()
x.SetAction(eacl.ActionAllow)
x.SetOperation(eacl.OperationRangeHash)
x.SetTargets(Target(), Target())
x.AddObjectContainerIDFilter(eacl.MatchStringEqual, cidtest.Generate())
x.AddObjectOwnerIDFilter(eacl.MatchStringNotEqual, ownertest.Generate())
return x
}