forked from TrueCloudLab/frostfs-node
[#525] morph/container: Do not return signature from GetEACL method
In previous implementation wrapper over the Container contract's client returned the signature of the eACL table in addition to itself. After recent changes in API Go lib table carries its signature. Thus, it is redundant to return the table signature separately. Make `Wrapper.GetEACL` method to return only `eacl.Table` with error. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
615813d6de
commit
df197dc38b
3 changed files with 14 additions and 10 deletions
|
@ -371,11 +371,13 @@ func (s *signedEACLTable) SignedDataSize() int {
|
|||
}
|
||||
|
||||
func (s *morphEACLStorage) GetEACL(cid *container.ID) (*eaclSDK.Table, error) {
|
||||
table, sig, err := s.w.GetEACL(cid)
|
||||
table, err := s.w.GetEACL(cid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sig := table.Signature()
|
||||
|
||||
if err := signature.VerifyDataWithSource(
|
||||
(*signedEACLTable)(table),
|
||||
func() ([]byte, []byte) {
|
||||
|
|
|
@ -12,23 +12,23 @@ import (
|
|||
|
||||
// GetEACL reads the extended ACL table from NeoFS system
|
||||
// through Container contract call.
|
||||
func (w *Wrapper) GetEACL(cid *containerSDK.ID) (*eacl.Table, *pkg.Signature, error) {
|
||||
func (w *Wrapper) GetEACL(cid *containerSDK.ID) (*eacl.Table, error) {
|
||||
if cid == nil {
|
||||
return nil, nil, errNilArgument
|
||||
return nil, errNilArgument
|
||||
}
|
||||
|
||||
args := client.EACLArgs{}
|
||||
|
||||
v2 := cid.ToV2()
|
||||
if v2 == nil {
|
||||
return nil, nil, errUnsupported // use other major version if there any
|
||||
return nil, errUnsupported // use other major version if there any
|
||||
}
|
||||
|
||||
args.SetCID(v2.GetValue())
|
||||
|
||||
rpcAnswer, err := w.client.EACL(args)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Client may not return errors if the table is missing, so check this case additionally.
|
||||
|
@ -36,7 +36,7 @@ func (w *Wrapper) GetEACL(cid *containerSDK.ID) (*eacl.Table, *pkg.Signature, er
|
|||
// since unsigned table cannot be approved in the storage by design.
|
||||
sig := rpcAnswer.Signature()
|
||||
if len(sig) == 0 {
|
||||
return nil, nil, container.ErrEACLNotFound
|
||||
return nil, container.ErrEACLNotFound
|
||||
}
|
||||
|
||||
tableSignature := pkg.NewSignature()
|
||||
|
@ -46,10 +46,12 @@ func (w *Wrapper) GetEACL(cid *containerSDK.ID) (*eacl.Table, *pkg.Signature, er
|
|||
table := eacl.NewTable()
|
||||
if err = table.Unmarshal(rpcAnswer.EACL()); err != nil {
|
||||
// use other major version if there any
|
||||
return nil, nil, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return table, tableSignature, nil
|
||||
table.SetSignature(tableSignature)
|
||||
|
||||
return table, nil
|
||||
}
|
||||
|
||||
// PutEACL marshals table, and passes it to Wrapper's PutEACLBinary method
|
||||
|
|
|
@ -102,14 +102,14 @@ func (s *morphExecutor) SetExtendedACL(ctx context.Context, body *container.SetE
|
|||
func (s *morphExecutor) GetExtendedACL(ctx context.Context, body *container.GetExtendedACLRequestBody) (*container.GetExtendedACLResponseBody, error) {
|
||||
cid := containerSDK.NewIDFromV2(body.GetContainerID())
|
||||
|
||||
table, signature, err := s.wrapper.GetEACL(cid)
|
||||
table, err := s.wrapper.GetEACL(cid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res := new(container.GetExtendedACLResponseBody)
|
||||
res.SetEACL(table.ToV2())
|
||||
res.SetSignature(signature.ToV2())
|
||||
res.SetSignature(table.Signature().ToV2())
|
||||
res.SetSessionToken(table.SessionToken().ToV2())
|
||||
|
||||
return res, nil
|
||||
|
|
Loading…
Reference in a new issue