2021-11-08 14:29:54 +00:00
|
|
|
package eacltest
|
|
|
|
|
|
|
|
import (
|
2023-03-07 11:20:03 +00:00
|
|
|
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl"
|
|
|
|
usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test"
|
|
|
|
versiontest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version/test"
|
2021-11-08 14:29:54 +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
|
|
|
|
}
|
|
|
|
|
|
|
|
// Record returns random eacl.Record.
|
|
|
|
func Record() *eacl.Record {
|
|
|
|
x := eacl.NewRecord()
|
|
|
|
|
|
|
|
x.SetAction(eacl.ActionAllow)
|
|
|
|
x.SetOperation(eacl.OperationRangeHash)
|
2022-03-11 09:02:53 +00:00
|
|
|
x.SetTargets(*Target(), *Target())
|
2021-11-12 11:19:16 +00:00
|
|
|
x.AddObjectContainerIDFilter(eacl.MatchStringEqual, cidtest.ID())
|
2022-04-11 06:30:22 +00:00
|
|
|
x.AddObjectOwnerIDFilter(eacl.MatchStringNotEqual, usertest.ID())
|
2021-11-08 14:29:54 +00:00
|
|
|
|
|
|
|
return x
|
|
|
|
}
|
|
|
|
|
|
|
|
func Table() *eacl.Table {
|
|
|
|
x := eacl.NewTable()
|
|
|
|
|
2021-11-12 11:19:16 +00:00
|
|
|
x.SetCID(cidtest.ID())
|
2021-11-08 14:29:54 +00:00
|
|
|
x.AddRecord(Record())
|
|
|
|
x.AddRecord(Record())
|
2022-03-23 15:35:44 +00:00
|
|
|
x.SetVersion(versiontest.Version())
|
2021-11-08 14:29:54 +00:00
|
|
|
|
|
|
|
return x
|
|
|
|
}
|