简体   繁体   English

v1.0的Hyperledger Fabric读取用户属性

[英]Hyperledger Fabric Read User Attribute for v1.0

In v0.6 i am able to read the user attribute using the shim.ChaincodeStubInterface.ReadCertAttribute. 在v0.6中,我可以使用shim.ChaincodeStubInterface.ReadCertAttribute读取用户属性。

However in v1.0 i am not able to buld the code as it will return a compilation error: 但是在v1.0中,我无法接受代码,因为它将返回编译错误:

stub.ReadCertAttribute undefined (type shim.ChaincodeStubInterface has no field or method ReadCertAttribute). stub.ReadCertAttribute未定义(类型shim.ChaincodeStubInterface没有字段或方法ReadCertAttribute)。

I cant seem to to find out what is the equivalent function for v1.0. 我似乎无法找出v1.0的等效功能。

May i know how can i read the user attribute for v1.0? 我可以知道如何读取v1.0的用户属性吗?

The equivalent function does not exist for v1.0 (see FAB-2046 ). 对于v1.0不存在等效功能(请参阅FAB-2046 )。

In Fabric v1.0, access control can be accomplished via policies that are configured on channels . 在Fabric v1.0中,可以通过在channel配置的 策略来完成访问控制。 There are also endorsement policies that help peers determine if a transaction has been properly endorsed. 还有一些背书策略 ,可帮助同伴确定交易是否已正确背书。

Fabric v1.0 also includes new methods on the chaincode stub API that you can use to perform your own ACL, including possibly replicating the functionality of ReadCertAttribute : Fabric v1.0在链码存根API上还包括新方法,可用于执行自己的ACL,包括可能复制ReadCertAttribute的功能:

  • GetSignedProposal() – returns the transaction proposal currently being executed. GetSignedProposal() –返回当前正在执行的交易建议。
  • GetCreator() – handy method to just get the identity of the submitter of the transaction. GetCreator() –方便的方法,用于获取事务提交者的身份。
  • GetTransient() – returns transient data attached to the transaction proposal GetTransient() –返回附加到交易建议的临时数据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM