Passed
Pull Request — master (#3)
by Timothy
06:14
created

MSPPrincipal   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 100
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 1
Metric Value
c 1
b 1
f 1
dl 0
loc 100
rs 10
wmc 5
1
<?php
2
# Generated by the protocol buffer compiler.  DO NOT EDIT!
3
# source: msp/msp_principal.proto
4
5
namespace Hyperledger\Fabric\Protos\MSP;
6
7
use Google\Protobuf\Internal\GPBType;
8
use Google\Protobuf\Internal\RepeatedField;
9
use Google\Protobuf\Internal\GPBUtil;
10
11
/**
12
 * MSPPrincipal aims to represent an MSP-centric set of identities.
13
 * In particular, this structure allows for definition of
14
 *  - a group of identities that are member of the same MSP
15
 *  - a group of identities that are member of the same organization unit
16
 *    in the same MSP
17
 *  - a group of identities that are administering a specific MSP
18
 *  - a specific identity
19
 * Expressing these groups is done given two fields of the fields below
20
 *  - Classification, that defines the type of classification of identities
21
 *    in an MSP this principal would be defined on; Classification can take
22
 *    three values:
23
 *     (i)  ByMSPRole: that represents a classification of identities within
24
 *          MSP based on one of the two pre-defined MSP rules, "member" and "admin"
25
 *     (ii) ByOrganizationUnit: that represents a classification of identities
26
 *          within MSP based on the organization unit an identity belongs to
27
 *     (iii)ByIdentity that denotes that MSPPrincipal is mapped to a single
28
 *          identity/certificate; this would mean that the Principal bytes
29
 *          message
30
 *
31
 * Generated from protobuf message <code>common.MSPPrincipal</code>
32
 */
33
class MSPPrincipal extends \Google\Protobuf\Internal\Message
34
{
35
    /**
36
     * Classification describes the way that one should process
37
     * Principal. An Classification value of "ByOrganizationUnit" reflects
38
     * that "Principal" contains the name of an organization this MSP
39
     * handles. A Classification value "ByIdentity" means that
40
     * "Principal" contains a specific identity. Default value
41
     * denotes that Principal contains one of the groups by
42
     * default supported by all MSPs ("admin" or "member").
43
     *
44
     * Generated from protobuf field <code>.common.MSPPrincipal.Classification principal_classification = 1;</code>
45
     */
46
    private $principal_classification = 0;
47
    /**
48
     * Principal completes the policy principal definition. For the default
49
     * principal types, Principal can be either "Admin" or "Member".
50
     * For the ByOrganizationUnit/ByIdentity values of Classification,
51
     * PolicyPrincipal acquires its value from an organization unit or
52
     * identity, respectively.
53
     *
54
     * Generated from protobuf field <code>bytes principal = 2;</code>
55
     */
56
    private $principal = '';
57
58
    public function __construct() {
59
        \GPBMetadata\Msp\MspPrincipal::initOnce();
60
        parent::__construct();
61
    }
62
63
    /**
64
     * Classification describes the way that one should process
65
     * Principal. An Classification value of "ByOrganizationUnit" reflects
66
     * that "Principal" contains the name of an organization this MSP
67
     * handles. A Classification value "ByIdentity" means that
68
     * "Principal" contains a specific identity. Default value
69
     * denotes that Principal contains one of the groups by
70
     * default supported by all MSPs ("admin" or "member").
71
     *
72
     * Generated from protobuf field <code>.common.MSPPrincipal.Classification principal_classification = 1;</code>
73
     * @return int
74
     */
75
    public function getPrincipalClassification()
76
    {
77
        return $this->principal_classification;
78
    }
79
80
    /**
81
     * Classification describes the way that one should process
82
     * Principal. An Classification value of "ByOrganizationUnit" reflects
83
     * that "Principal" contains the name of an organization this MSP
84
     * handles. A Classification value "ByIdentity" means that
85
     * "Principal" contains a specific identity. Default value
86
     * denotes that Principal contains one of the groups by
87
     * default supported by all MSPs ("admin" or "member").
88
     *
89
     * Generated from protobuf field <code>.common.MSPPrincipal.Classification principal_classification = 1;</code>
90
     * @param int $var
91
     * @return $this
92
     */
93
    public function setPrincipalClassification($var)
94
    {
95
        GPBUtil::checkEnum($var, \Hyperledger\Fabric\Protos\MSP\MSPPrincipal_Classification::class);
96
        $this->principal_classification = $var;
97
98
        return $this;
99
    }
100
101
    /**
102
     * Principal completes the policy principal definition. For the default
103
     * principal types, Principal can be either "Admin" or "Member".
104
     * For the ByOrganizationUnit/ByIdentity values of Classification,
105
     * PolicyPrincipal acquires its value from an organization unit or
106
     * identity, respectively.
107
     *
108
     * Generated from protobuf field <code>bytes principal = 2;</code>
109
     * @return string
110
     */
111
    public function getPrincipal()
112
    {
113
        return $this->principal;
114
    }
115
116
    /**
117
     * Principal completes the policy principal definition. For the default
118
     * principal types, Principal can be either "Admin" or "Member".
119
     * For the ByOrganizationUnit/ByIdentity values of Classification,
120
     * PolicyPrincipal acquires its value from an organization unit or
121
     * identity, respectively.
122
     *
123
     * Generated from protobuf field <code>bytes principal = 2;</code>
124
     * @param string $var
125
     * @return $this
126
     */
127
    public function setPrincipal($var)
128
    {
129
        GPBUtil::checkString($var, False);
130
        $this->principal = $var;
131
132
        return $this;
133
    }
134
135
}
136
137