From 9cb198d4110ed6b239f29f68f79dcf760e9fed6c Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Thu, 29 Aug 2024 09:49:56 +0300 Subject: [PATCH] Add printing user info Signed-off-by: Denis Kirillov --- modules/chains/list_user.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/chains/list_user.go b/modules/chains/list_user.go index 64afe55..ba0f58a 100644 --- a/modules/chains/list_user.go +++ b/modules/chains/list_user.go @@ -2,6 +2,7 @@ package chains import ( "encoding/base64" + "encoding/hex" "errors" "fmt" "math/big" @@ -85,6 +86,8 @@ func runListCmd(cmd *cobra.Command, _ []string) error { 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)) if err != nil { return err @@ -188,3 +191,13 @@ func parseService(service string) (apechain.Name, error) { 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) + } +}