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:26:23 +00:00
|
|
|
sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test"
|
2021-06-08 11:34:44 +00:00
|
|
|
refstest "github.com/nspcc-dev/neofs-api-go/pkg/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
|
|
|
|
}
|
2021-06-08 08:26:23 +00:00
|
|
|
|
|
|
|
func Table() *eacl.Table {
|
|
|
|
x := eacl.NewTable()
|
|
|
|
|
|
|
|
x.SetCID(cidtest.Generate())
|
|
|
|
x.SetSessionToken(sessiontest.Generate())
|
|
|
|
x.AddRecord(Record())
|
|
|
|
x.AddRecord(Record())
|
2021-06-08 11:34:44 +00:00
|
|
|
x.SetVersion(*refstest.Version())
|
|
|
|
x.SetSignature(refstest.Signature())
|
2021-06-08 08:26:23 +00:00
|
|
|
|
|
|
|
return x
|
|
|
|
}
|