Reputation: 141
I have created network using Hyperledger Farbic. Crypto - certificates was created with configtxgen tool, So, i created channel tx with:
configtxgen -profile SampleChannel -outputCreateChannelTx ./config/SampleChannel.tx -channelID SampleChannel
So, by default Admins
"policies": {
"Admins": {
"mod_policy": "Admins",
"policy": {
"type": 3,
"value": {
"rule": "MAJORITY",
"sub_policy": "Admins"
}
},
"version": "0"
}
How can I change mod_policy
to
"policies": {
"Admins": {
"mod_policy": "Admins",
"policy": {
"type": 3,
"value": {
"rule": "ANY", // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
"sub_policy": "Admins"
}
},
"version": "0"
}
My next step is to
configtxgen -profile SampleChannel -outputAnchorPeersUpdate ./config/SampleChannel.tx -channelID SampleChannel -asOrg Org1MSP
But how can I use manually changed SampleChannel.tx to apply it to network?
Thanks so much for help
Upvotes: 1
Views: 657
Reputation: 4133
Policies are two Types
Signature policies
These policies identify specific users who must sign in order for a policy to be satisfied.
For Example:
Policies:
MyPolicy:
Type: Signature
Rule: “Org1.Peer OR Org2.Peer”
ImplicitMeta policies
ImplicitMeta policies aggregate the result of policies deeper into the configuration hierarchy that are ultimately defined by Signature policies. They support default rules like “A majority of the organization admins”. These policies use a different but still very simple syntax as compared to Signature policies: <ALL|ANY|MAJORITY> <sub_policy>
.
For example ANY Readers or MAJORITY Admins.
Policies:
MyPolicy:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
Coming to your Answer: While creating the config.tx Please make below changes
Channel: &ChannelDefaults
Policies:
# Who may invoke the 'Deliver' API
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
# Who may invoke the 'Broadcast' API
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
# By default, who may modify elements at this config level
Admins:
Type: ImplicitMeta
Rule: "ANY Writers"
If you want more specific instead of NAY Writers and want to specify only particular organization Admins. Use below snippet
Channel: &ChannelDefaults
Policies:
# Who may invoke the 'Deliver' API
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
# Who may invoke the 'Broadcast' API
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
# By default, who may modify elements at this config level
Admins:
Type: Signature
Rule: "OR('Org1.admin')"
Upvotes: 2