Add printing user info

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
Denis Kirillov 2024-08-29 09:49:56 +03:00
parent c40ad3627d
commit 9cb198d411

View file

@ -2,6 +2,7 @@ package chains
import ( import (
"encoding/base64" "encoding/base64"
"encoding/hex"
"errors" "errors"
"fmt" "fmt"
"math/big" "math/big"
@ -85,6 +86,8 @@ func runListCmd(cmd *cobra.Command, _ []string) error {
return err return err
} }
printSubject(cmd, subj)
res, err := commonclient.ReadIteratorItems(invoker.New(rpcCli, nil), 100, policyHash, "iteratorChainsByPrefix", big.NewInt(int64(policycontract.Namespace)), subj.Namespace, string(service)) res, err := commonclient.ReadIteratorItems(invoker.New(rpcCli, nil), 100, policyHash, "iteratorChainsByPrefix", big.NewInt(int64(policycontract.Namespace)), subj.Namespace, string(service))
if err != nil { if err != nil {
return err return err
@ -188,3 +191,13 @@ func parseService(service string) (apechain.Name, error) {
return "", errUnknownServiceType return "", errUnknownServiceType
} }
func printSubject(cmd *cobra.Command, subj *ffsidclient.SubjectExtended) {
cmd.Println("ns:", subj.Namespace)
cmd.Println("name:", subj.Name)
cmd.Println("key:", hex.EncodeToString(subj.PrimaryKey.Bytes()))
cmd.Println("claims:")
for k, v := range subj.KV {
cmd.Println(k, v)
}
}