hyperledger-archives / education

Hyperledger training material
https://wiki.hyperledger.org/display/LMDWG
Apache License 2.0
372 stars 360 forks source link

How to manage role based access in Chaincode #117

Open rushikeshacharya opened 6 years ago

rushikeshacharya commented 6 years ago

I want to put restriction on uses according to their role to call chaincode functions. For eg. In tunaFish example I do not want the Regulator or Restaurateur to call a function recordTuna. So how do I manage this. Can we restrict this access in chaincode or do we have to manange this at application side?

vishal3152 commented 6 years ago

You should handle this in the chaincode. Attribute-based access control can be of help here. You can query the role attribute in your chaincode and put access restriction as required.

https://hyperledger-fabric-ca.readthedocs.io/en/latest/users-guide.html