Skip to content

Commit

Permalink
update the logic to check the OU of cert and show
Browse files Browse the repository at this point in the history
Signed-off-by: Prakash P S <prakashps@Prakashs-MacBook-Pro.local>
  • Loading branch information
Prakash P S authored and Prakash P S committed Sep 12, 2023
1 parent 315ebdd commit 3b0141a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
1 change: 1 addition & 0 deletions packages/apollo/src/assets/i18n/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
"grant_tooltip": "The only supported grant is \"authorization_code\".",
"response_type_label": "Response type",
"response_type_tooltip": "The only supported response type is \"code\".",
"msp_admin_type_tooltip": "These are identities in your wallet that are also admins on this channel",
"debug_label": "User login debug logs",
"debug_logs_tooltip": "Extra console server logs during user login can help debug OAuth2.0 setup issues, but for maximum user privacy this setting should be off once login problems are resolved.",
"default_password_placeholder": "Enter a password here",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ class UpdateChannelMspModal extends React.Component {
disableSubmit: !this.props.isOrdererMSP,
});
}

async onSelectMSP(event) {
if (event.selectedMsp) {
this.populateMSP(event.selectedMsp);
Expand Down Expand Up @@ -342,30 +343,21 @@ class UpdateChannelMspModal extends React.Component {
default: 'select_msp_id',
},
];
if (this.props.submit_identity_options && !this.props.isOrdererMSP && this.props.submit_identity_options.length < 6) {
this.props.submit_identity_options.map((admin, index) => {
if (!admin.cas) {
if (index < 1) {
fields.push({
label: 'Admins',
name: 'admin_identity',
type: 'text',
default: admin.name,
readonly: true,
});
}
else {
fields.push({
label: 'Admins',
name: 'admin_identity',
type: 'text',
default: admin.name,
readonly: true,
hideLabel: true,
});
}
}
})
if (this.props.submit_identity_options && !this.props.isOrdererMSP) {
let mspAdmins = this.populateMSPAdmins();
fields.push({
label: 'Known channel admins',
name: 'admin_identity',
type: 'component',
default:
mspAdmins.map((val, idx) =>
<div key={idx}>
<p>{val}</p>
</div>),
readonly: true,
tooltip: 'msp_admin_type_tooltip',
tooltipDirection: 'top',
});
}
if (!this.props.isOrdererMSP) {
fields.push({
Expand All @@ -379,6 +371,20 @@ class UpdateChannelMspModal extends React.Component {
return fields;
}

populateMSPAdmins()
{
const admin_identites = [];
this.props.submit_identity_options.forEach(value => {
const parsed_msp_cert = StitchApi.parseCertificate(value.cert);
if (admin_identites.length < 6)
{
if (parsed_msp_cert.subject_parts.OU === 'admin') {
admin_identites.push(value.name);
}
}
});
return admin_identites;
}
renderUploadMSPDefinition(translate) {
return (
<WizardStep
Expand Down

0 comments on commit 3b0141a

Please sign in to comment.