|
| 1 | +/* |
| 2 | +Copyright IBM Corp. 2016 All Rights Reserved. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | + |
| 18 | +syntax = "proto3"; |
| 19 | + |
| 20 | +option go_package = "github.com/hyperledger/fabric/protos/common"; |
| 21 | + |
| 22 | +package common; |
| 23 | + |
| 24 | + |
| 25 | +// chain-config.proto contains proto messages defining the schema of |
| 26 | +// a chain configuration structure. An example of how |
| 27 | +// this could be |
| 28 | +// -- VerifierMSPlist carries information associated to MSPs governing |
| 29 | +// the chain |
| 30 | +// -- MSPPrincipal carries the information needed to define policies |
| 31 | +// for reading/writing or managing the chain |
| 32 | +// |
| 33 | +// An example of chain configuration could set the following parameters: |
| 34 | +// -- an array of msp.MSPConfig items to denote the list of MSPs that govern |
| 35 | +// the chain |
| 36 | +// -- readers: a list of MSPPrincipal assuming that by default ANY entity |
| 37 | +// being part of this list is able to read transactions of that chain |
| 38 | +// -- writers: a list of MSPPrincipal assuming that by default ANY entity |
| 39 | +// being part of this list is able to submit transactions to that chain |
| 40 | +// -- admins: a list of MSPPrincipal assuming that by default ANY entity |
| 41 | +// being part of this list is able to modify the configuraiton of that |
| 42 | +// chain. |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +// MSPPrincipal aims to represent an MSP-centric set of identities. |
| 47 | +// In particular, this structure allows for definition of |
| 48 | +// - a group of identities that are member of the same MSP |
| 49 | +// - a group of identities that are member of the same organization unit |
| 50 | +// in the same MSP |
| 51 | +// - a group of identities that are administering a specific MSP |
| 52 | +// - a specific identity |
| 53 | +// Expressing these groups is done given two fields of the fields below |
| 54 | +// - Classification, that defines the type of classification of identities |
| 55 | +// in an MSP this principal would be defined on; Classification can take |
| 56 | +// three values: |
| 57 | +// (i) ByMSPRole: that represents a classification of identities within |
| 58 | +// MSP based on one of the two pre-defined MSP rules, "member" and "admin" |
| 59 | +// (ii) ByOrganizationUnit: that represents a classification of identities |
| 60 | +// within MSP based on the organization unit an identity belongs to |
| 61 | +// (iii)ByIdentity that denotes that MSPPrincipal is mapped to a single |
| 62 | +// identity/certificate; this would mean that the Principal bytes |
| 63 | +// message |
| 64 | +message MSPPrincipal { |
| 65 | + |
| 66 | + enum Classification { |
| 67 | + ByMSPRole = 0; // Represents the one of the dedicated MSP roles, the |
| 68 | + // one of a member of MSP network, and the one of an |
| 69 | + // administrator of an MSP network |
| 70 | + ByOrganizationUnit = 1; // Denotes a finer grained (affiliation-based) |
| 71 | + // groupping of entities, per MSP affiliation |
| 72 | + // E.g., this can well be represented by an MSP's |
| 73 | + // Organization unit |
| 74 | + ByIdentity = 2; // Denotes a principal that consists of a single |
| 75 | + // identity |
| 76 | + } |
| 77 | + |
| 78 | + // Classification describes the way that one should process |
| 79 | + // Principal. An Classification value of "ByOrganizationUnit" reflects |
| 80 | + // that "Principal" contains the name of an organization this MSP |
| 81 | + // handles. A Classification value "ByIdentity" means that |
| 82 | + // "Principal" contains a specific identity. Default value |
| 83 | + // denotes that Principal contains one of the groups by |
| 84 | + // default supported by all MSPs ("admin" or "member"). |
| 85 | + Classification PrincipalClassification = 1; |
| 86 | + |
| 87 | + // Principal completes the policy principal definition. For the default |
| 88 | + // principal types, Principal can be either "Admin" or "Member". |
| 89 | + // For the ByOrganizationUnit/ByIdentity values of Classification, |
| 90 | + // PolicyPrincipal acquires its value from an organization unit or |
| 91 | + // identity, respectively. |
| 92 | + bytes Principal = 3; |
| 93 | +} |
| 94 | + |
| 95 | + |
| 96 | +// OrganizationUnit governs the organization of the Principal |
| 97 | +// field of a policy principal when a specific organization unity members |
| 98 | +// are to be defined within a policy principal. |
| 99 | +message OrganizationUnit { |
| 100 | + |
| 101 | + // MSPIdentifier represents the identifier of the MSP this organization unit |
| 102 | + // refers to |
| 103 | + string MSPIdentifier = 1; |
| 104 | + |
| 105 | + // OrganizationUnitIdentifier defines the organization unit under the |
| 106 | + // MSP identified with MSPIdentifier |
| 107 | + string OrganizationUnitIdentifier = 2; |
| 108 | + |
| 109 | +} |
| 110 | + |
| 111 | +// MSPRole governs the organization of the Principal |
| 112 | +// field of an MSPPrincipal when it aims to define one of the |
| 113 | +// two dedicated roles within an MSP: Admin and Members. |
| 114 | +message MSPRole { |
| 115 | + |
| 116 | + // MSPIdentifier represents the identifier of the MSP this principal |
| 117 | + // refers to |
| 118 | + string MSPIdentifier = 1; |
| 119 | + |
| 120 | + enum MSPRoleType { |
| 121 | + Member = 0; // Represents an MSP Member |
| 122 | + Admin = 1; // Represents an MSP Admin |
| 123 | + } |
| 124 | + |
| 125 | + // MSPRoleType defines which of the available, pre-defined MSP-roles |
| 126 | + // an identiy should posess inside the MSP with identifier MSPidentifier |
| 127 | + MSPRoleType Role = 2; |
| 128 | + |
| 129 | +} |
| 130 | + |
| 131 | + |
| 132 | +// TODO: Bring msp.SerializedIdentity from fabric/msp/identities.proto here. Reason below. |
| 133 | +// SerializedIdentity represents an serialized version of an identity; |
| 134 | +// this consists of an MSP-identifier this identity would correspond to |
| 135 | +// and the bytes of the actual identity. A serialized form of |
| 136 | +// SerializedIdentity would govern "Principal" field of a PolicyPrincipal |
| 137 | +// of classification "ByIdentity". |
0 commit comments