forked from TrueCloudLab/frostfs-sdk-go
[#58] eacl: move package from neofs-api-go
Also, remove deprecated methods. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
f05ff3901f
commit
8d313dbd5d
11 changed files with 2025 additions and 0 deletions
45
eacl/test/generate.go
Normal file
45
eacl/test/generate.go
Normal file
|
@ -0,0 +1,45 @@
|
|||
package eacltest
|
||||
|
||||
import (
|
||||
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/eacl"
|
||||
ownertest "github.com/nspcc-dev/neofs-sdk-go/owner/test"
|
||||
versiontest "github.com/nspcc-dev/neofs-sdk-go/version/test"
|
||||
)
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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.GenerateID())
|
||||
x.AddObjectOwnerIDFilter(eacl.MatchStringNotEqual, ownertest.GenerateID())
|
||||
|
||||
return x
|
||||
}
|
||||
|
||||
func Table() *eacl.Table {
|
||||
x := eacl.NewTable()
|
||||
|
||||
x.SetCID(cidtest.GenerateID())
|
||||
x.AddRecord(Record())
|
||||
x.AddRecord(Record())
|
||||
x.SetVersion(*versiontest.Version())
|
||||
|
||||
return x
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue