client: Check CID is set to eacl table in ContainerSetEACL command

Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
This commit is contained in:
Evgenii Baidakov 2023-04-14 10:48:06 +04:00
parent 493fa50915
commit dfb799783e
No known key found for this signature in database
GPG key ID: 8733EE3D72CDB4DE

View file

@ -602,7 +602,7 @@ type PrmContainerSetEACL struct {
}
// SetTable sets eACL table structure to be set for the container.
// Required parameter.
// Required parameter and CID must be set inside the table.
func (x *PrmContainerSetEACL) SetTable(table eacl.Table) {
x.table = table
x.tableSet = true
@ -656,6 +656,11 @@ func (c *Client) ContainerSetEACL(ctx context.Context, prm PrmContainerSetEACL)
panic("eACL table not set")
}
_, isCIDSet := prm.table.CID()
if !isCIDSet {
panic("missing container in eACL table")
}
// sign the eACL table
eaclV2 := prm.table.ToV2()