2021-06-08 08:18:36 +00:00
|
|
|
package eacltest
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
|
2021-06-08 08:22:58 +00:00
|
|
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
|
|
|
ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test"
|
2021-06-08 08:18:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Target returns random eacl.Target.
|
|
|
|
func Target() *eacl.Target {
|
|
|
|
x := eacl.NewTarget()
|
|
|
|
|
|
|
|
x.SetRole(eacl.RoleSystem)
|
|
|
|
x.SetBinaryKeys([][]byte{
|
|
|
|
{1, 2, 3},
|
|
|
|
{4, 5, 6},
|
|
|
|
})
|
|
|
|
|
|
|
|
return x
|
|
|
|
}
|
2021-06-08 08:22:58 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|