Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FAB-18268] Add SetPolicies() to easily replace multiple policies in an existing configuration with the given policies #39

Merged
merged 8 commits into from
Oct 13, 2020

Conversation

satota2
Copy link
Contributor

@satota2 satota2 commented Oct 13, 2020

This patch adds SetPolicies() to easily replace multiple policies for groups and orgs in an existing configuration with the given policies.

Type of change

  • New feature
  • Test update

Description

This patch adds SetPolicies() to easily replace multiple policies for groups and orgs in an existing configuration with the given policies.

Targets to add the new functions:

  • ApplicationGroup
  • ApplicationOrg
  • ChannelGroup
  • ConsortiumOrg
  • OrdererGroup
  • OrdererOrg

By providing functions to replace multiple policies in bulk, users can change multiple policies with a single function call, so users should not need a tedious method (e.g., repeat SetPolicy() and RemovePolicy() for a group to be replaced).

As preparation for supporting SetPolicies() for groups and orgs, this patch modifies setPolicies() in configtx/policies.go in to clear all existing policies in an existing configuration and then replace them with the given policies.

Also, this patch fixes minor typos in comments.

Related issues

…ng configuration with the given ones

Currently, setPolicies() upserts policies in an existing configuration with
the given ones. This speficifation makes it difficult to remove multiple
policies that are not needed.

In preparation for supporting SetPolicies() for groups and orgs,
this patch modifies setPolicies() to clear all existing policies in an
existing configuration and then replace them with the given policies.

Signed-off-by: Tatsuya Sato <Tatsuya.Sato@hal.hitachi.com>
This patch adds SetPolicies() to easily replace multiple policies for
a channel group in an existing configuration with the given ones.

Signed-off-by: Tatsuya Sato <Tatsuya.Sato@hal.hitachi.com>
This patch adds SetPolicies() to easily replace multiple policies for
an application group in an existing configuration with the given ones.

Signed-off-by: Tatsuya Sato <Tatsuya.Sato@hal.hitachi.com>
This patch adds SetPolicies() to easily replace multiple policies for
an orderer group in an existing configuration with the given ones.

Signed-off-by: Tatsuya Sato <Tatsuya.Sato@hal.hitachi.com>
This patch adds SetPolicies() to easily replace multiple policies for
an application org in an existing configuration with the given ones.

Signed-off-by: Tatsuya Sato <Tatsuya.Sato@hal.hitachi.com>
This patch adds SetPolicies() to easily replace multiple policies for
an orderer org in an existing configuration with the given ones.

Signed-off-by: Tatsuya Sato <Tatsuya.Sato@hal.hitachi.com>
This patch adds SetPolicies() to easily replace multiple policies for
a consortium org in an existing configuration with the given ones.

Signed-off-by: Tatsuya Sato <Tatsuya.Sato@hal.hitachi.com>
Signed-off-by: Tatsuya Sato <Tatsuya.Sato@hal.hitachi.com>
@satota2 satota2 requested a review from a team as a code owner October 13, 2020 01:08
Copy link
Contributor

@caod123 caod123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally when the API was designed, we considered having a bulk policy update for the entire policies field but then decided to scrap it after being unable to come up with use cases for it outside of adding or removing single policies. If this change satisfies any use cases that are more convenient for you, then we welcome the contribution :)

@caod123 caod123 merged commit 0571449 into hyperledger:master Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants