[#225] container: Refactor and document basic ACL

Replace basic ACL functionality from `acl` package to the `container`
one. Create `BasicACL` type and provide convenient interface to work
with it.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-06-16 09:17:41 +03:00 committed by fyrchik
parent af7e20073b
commit e82a2d86ef
13 changed files with 961 additions and 247 deletions

View file

@ -7,7 +7,6 @@ import (
"github.com/nspcc-dev/neofs-api-go/v2/container"
v2netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/nspcc-dev/neofs-sdk-go/acl"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/netmap"
"github.com/nspcc-dev/neofs-sdk-go/user"
@ -23,7 +22,7 @@ type Container struct {
// Defaults:
// - token: nil;
// - sig: nil;
// - basicACL: acl.PrivateBasicRule;
// - basicACL: BasicACLPrivate;
// - version: version.Current;
// - nonce: random UUID;
// - attr: nil;
@ -136,12 +135,13 @@ func (c *Container) SetNonceUUID(v uuid.UUID) {
c.v2.SetNonce(data)
}
func (c *Container) BasicACL() uint32 {
return c.v2.GetBasicACL()
func (c *Container) BasicACL() (res BasicACL) {
res.fromUint32(c.v2.GetBasicACL())
return
}
func (c *Container) SetBasicACL(v acl.BasicACL) {
c.v2.SetBasicACL(uint32(v))
func (c *Container) SetBasicACL(v BasicACL) {
c.v2.SetBasicACL(v.toUint32())
}
func (c *Container) Attributes() Attributes {