forked from TrueCloudLab/frostfs-node
[#525] morph/container: Do not accept signature in PutEACL function
In previous implementation wrapper over the Container contract's client accepted 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 pass the eACL table signature separately. Make `wrapper.PutEACL` method to accept `eacl.Table` only. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
32828d2b90
commit
1deb3f3d01
2 changed files with 8 additions and 4 deletions
|
@ -5,14 +5,14 @@ import (
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg"
|
"github.com/nspcc-dev/neofs-api-go/pkg"
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
|
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
|
||||||
containerSDK "github.com/nspcc-dev/neofs-api-go/pkg/container"
|
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/container"
|
"github.com/nspcc-dev/neofs-node/pkg/core/container"
|
||||||
client "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
|
client "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetEACL reads the extended ACL table from NeoFS system
|
// GetEACL reads the extended ACL table from NeoFS system
|
||||||
// through Container contract call.
|
// through Container contract call.
|
||||||
func (w *Wrapper) GetEACL(cid *containerSDK.ID) (*eacl.Table, error) {
|
func (w *Wrapper) GetEACL(cid *cid.ID) (*eacl.Table, error) {
|
||||||
if cid == nil {
|
if cid == nil {
|
||||||
return nil, errNilArgument
|
return nil, errNilArgument
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ func (w *Wrapper) GetEACL(cid *containerSDK.ID) (*eacl.Table, error) {
|
||||||
// Returns error if table is nil.
|
// Returns error if table is nil.
|
||||||
//
|
//
|
||||||
// If TryNotary is provided, calls notary contract.
|
// If TryNotary is provided, calls notary contract.
|
||||||
func PutEACL(w *Wrapper, table *eacl.Table, sig *pkg.Signature) error {
|
func PutEACL(w *Wrapper, table *eacl.Table) error {
|
||||||
if table == nil {
|
if table == nil {
|
||||||
return errNilArgument
|
return errNilArgument
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,8 @@ func PutEACL(w *Wrapper, table *eacl.Table, sig *pkg.Signature) error {
|
||||||
return fmt.Errorf("can't marshal eacl table: %w", err)
|
return fmt.Errorf("can't marshal eacl table: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sig := table.Signature()
|
||||||
|
|
||||||
return w.PutEACL(data, sig.Key(), sig.Sign())
|
return w.PutEACL(data, sig.Key(), sig.Sign())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,9 @@ func (s *morphExecutor) SetExtendedACL(ctx context.Context, body *container.SetE
|
||||||
table := eaclSDK.NewTableFromV2(body.GetEACL())
|
table := eaclSDK.NewTableFromV2(body.GetEACL())
|
||||||
sign := pkg.NewSignatureFromV2(body.GetSignature())
|
sign := pkg.NewSignatureFromV2(body.GetSignature())
|
||||||
|
|
||||||
err := wrapper.PutEACL(s.wrapper, table, sign)
|
table.SetSignature(sign)
|
||||||
|
|
||||||
|
err := wrapper.PutEACL(s.wrapper, table)
|
||||||
|
|
||||||
return new(container.SetExtendedACLResponseBody), err
|
return new(container.SetExtendedACLResponseBody), err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue