[#xxx] Upgrade NeoFS SDK Go with changed container sessions

After recent changes in NeoFS SDK Go library session tokens aren't
embedded into `container.Container` and `eacl.Table` structures.

Group value, session token and signature in a structure for container
and eACL.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-06-22 13:55:31 +03:00 committed by fyrchik
parent 633b4e7d2d
commit b67974a8d3
26 changed files with 152 additions and 168 deletions

View file

@ -98,7 +98,6 @@ It will be stored in sidechain when inner ring will accepts it.`,
issuer := tok.Issuer()
cnr.SetOwnerID(&issuer)
cnr.SetSessionToken(tok)
} else {
var idOwner user.ID
user.IDFromKey(&idOwner, key.PublicKey)
@ -113,7 +112,6 @@ It will be stored in sidechain when inner ring will accepts it.`,
cnr.SetBasicACL(basicACL)
cnr.SetAttributes(attributes)
cnr.SetNonceUUID(nonce)
cnr.SetSessionToken(tok)
cli := internalclient.GetSDKClientByFlag(cmd, key, commonflags.RPC)
@ -121,6 +119,10 @@ It will be stored in sidechain when inner ring will accepts it.`,
putPrm.SetClient(cli)
putPrm.SetContainer(*cnr)
if tok != nil {
putPrm.WithinSession(*tok)
}
res, err := internalclient.PutContainer(putPrm)
common.ExitOnErr(cmd, "rpc error: %w", err)

View file

@ -3,7 +3,6 @@ package container
import (
"os"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
internalclient "github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/client"
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/common"
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/commonflags"
@ -29,22 +28,10 @@ var getExtendedACLCmd = &cobra.Command{
eaclTable := res.EACL()
sig := eaclTable.Signature()
// TODO(@cthulhu-rider): #1387 avoid type conversion
var sigV2 refs.Signature
sig.WriteToV2(&sigV2)
if containerPathTo == "" {
cmd.Println("eACL: ")
common.PrettyPrintJSON(cmd, eaclTable, "eACL")
var sigV2 refs.Signature
sig.WriteToV2(&sigV2)
cmd.Println("Signature:")
common.PrettyPrintJSON(cmd, &sigV2, "signature")
return
}
@ -60,9 +47,6 @@ var getExtendedACLCmd = &cobra.Command{
cmd.Println("dumping data to file:", containerPathTo)
cmd.Println("Signature:")
common.PrettyPrintJSON(cmd, &sigV2, "signature")
err = os.WriteFile(containerPathTo, data, 0644)
common.ExitOnErr(cmd, "could not write eACL to file: %w", err)
},

View file

@ -32,7 +32,6 @@ Container ID in EACL table will be substituted with ID from the CLI.`,
}
eaclTable.SetCID(id)
eaclTable.SetSessionToken(tok)
pk := key.GetOrGenerate(cmd)
cli := internalclient.GetSDKClientByFlag(cmd, pk, commonflags.RPC)
@ -41,6 +40,10 @@ Container ID in EACL table will be substituted with ID from the CLI.`,
setEACLPrm.SetClient(cli)
setEACLPrm.SetTable(*eaclTable)
if tok != nil {
setEACLPrm.WithinSession(*tok)
}
_, err := internalclient.SetEACL(setEACLPrm)
common.ExitOnErr(cmd, "rpc error: %w", err)