[#250] eacl: Do not require CID in eACL table

Container ID of extended ACL table can be omitted in bearer token according
to API.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-05-25 11:26:45 +03:00 committed by LeL
parent c65be6d469
commit d3b998d672

View file

@ -2,7 +2,6 @@ package eacl
import ( import (
"crypto/sha256" "crypto/sha256"
"errors"
"fmt" "fmt"
v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl"
@ -183,8 +182,6 @@ func (t *Table) Marshal() ([]byte, error) {
return t.ToV2().StableMarshal(nil), nil return t.ToV2().StableMarshal(nil), nil
} }
var errCIDNotSet = errors.New("container ID is not set")
// Unmarshal unmarshals protobuf binary representation of Table. // Unmarshal unmarshals protobuf binary representation of Table.
func (t *Table) Unmarshal(data []byte) error { func (t *Table) Unmarshal(data []byte) error {
fV2 := new(v2acl.Table) fV2 := new(v2acl.Table)
@ -255,7 +252,7 @@ func checkFormat(v2 *v2acl.Table) error {
cidV2 := v2.GetContainerID() cidV2 := v2.GetContainerID()
if cidV2 == nil { if cidV2 == nil {
return errCIDNotSet return nil
} }
err := cID.ReadFromV2(*cidV2) err := cID.ReadFromV2(*cidV2)