[#283] client/container: Write new fields to eACL table in GetEACL
Call `SetSessionToken` and `SetSignature` methods on resulting eACL table with items from response body. From now eACL signature can be accessed from the table itself, so `EACLWithSignature.Signature` is marked deprecated. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
ad6b5aa8a9
commit
25de451a2f
1 changed files with 14 additions and 5 deletions
|
@ -49,8 +49,6 @@ type delContainerSignWrapper struct {
|
||||||
// EACLWithSignature represents eACL table/signature pair.
|
// EACLWithSignature represents eACL table/signature pair.
|
||||||
type EACLWithSignature struct {
|
type EACLWithSignature struct {
|
||||||
table *eacl.Table
|
table *eacl.Table
|
||||||
|
|
||||||
sig *pkg.Signature
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c delContainerSignWrapper) ReadSignedData(bytes []byte) ([]byte, error) {
|
func (c delContainerSignWrapper) ReadSignedData(bytes []byte) ([]byte, error) {
|
||||||
|
@ -67,8 +65,10 @@ func (e EACLWithSignature) EACL() *eacl.Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signature returns table signature.
|
// Signature returns table signature.
|
||||||
|
//
|
||||||
|
// Deprecated: use EACL().Signature() instead.
|
||||||
func (e EACLWithSignature) Signature() *pkg.Signature {
|
func (e EACLWithSignature) Signature() *pkg.Signature {
|
||||||
return e.sig
|
return e.table.Signature()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) {
|
func (c *clientImpl) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) {
|
||||||
|
@ -333,9 +333,18 @@ func (c *clientImpl) GetEACL(ctx context.Context, id *container.ID, opts ...Call
|
||||||
|
|
||||||
body := resp.GetBody()
|
body := resp.GetBody()
|
||||||
|
|
||||||
|
table := eacl.NewTableFromV2(body.GetEACL())
|
||||||
|
|
||||||
|
table.SetSessionToken(
|
||||||
|
session.NewTokenFromV2(body.GetSessionToken()),
|
||||||
|
)
|
||||||
|
|
||||||
|
table.SetSignature(
|
||||||
|
pkg.NewSignatureFromV2(body.GetSignature()),
|
||||||
|
)
|
||||||
|
|
||||||
return &EACLWithSignature{
|
return &EACLWithSignature{
|
||||||
table: eacl.NewTableFromV2(body.GetEACL()),
|
table: table,
|
||||||
sig: pkg.NewSignatureFromV2(body.GetSignature()),
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue