open-vault/ui/app/models/pki-ca-certificate-sign.js
Alexander Scheel dc4965f27d
Fix naming of permitted_dns_domains in webui (#16739)
* Fix naming of permitted_dns_domains in webui

PKI has consistently used permitted_dns_domains since it was originally
introduced as a parameter. However, it appears the Web UI was updated to
add this field, but used an incorrect internal identifier
(permittedDnsNames rather than permittedDnsDomains).

This triggers a warning from the backend about an unknown parameter, and
the domain restriction isn't added:

> Endpoint ignored these unrecognized parameters: [permitted_dns_names]

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add changelog

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2022-08-16 14:57:05 -05:00

76 lines
1.6 KiB
JavaScript

import { attr } from '@ember-data/model';
import { copy } from 'ember-copy';
import { computed } from '@ember/object';
import Certificate from './pki-certificate-sign';
export default Certificate.extend({
backend: attr('string', {
readOnly: true,
}),
useCsrValues: attr('boolean', {
defaultValue: false,
label: 'Use CSR values',
}),
maxPathLength: attr('number', {
defaultValue: -1,
}),
permittedDnsDomains: attr('string', {
label: 'Permitted DNS domains',
}),
ou: attr({
label: 'OU (OrganizationalUnit)',
editType: 'stringArray',
}),
organization: attr({
editType: 'stringArray',
}),
country: attr({
editType: 'stringArray',
}),
locality: attr({
editType: 'stringArray',
label: 'Locality/City',
}),
province: attr({
editType: 'stringArray',
label: 'Province/State',
}),
streetAddress: attr({
editType: 'stringArray',
}),
postalCode: attr({
editType: 'stringArray',
}),
fieldGroups: computed('useCsrValues', function () {
const options = [
{
Options: [
'altNames',
'ipSans',
'ttl',
'excludeCnFromSans',
'maxPathLength',
'permittedDnsDomains',
'ou',
'organization',
'otherSans',
],
},
{
'Address Options': ['country', 'locality', 'province', 'streetAddress', 'postalCode'],
},
];
let groups = [
{
default: ['csr', 'commonName', 'format', 'useCsrValues'],
},
];
if (this.useCsrValues === false) {
groups = groups.concat(options);
}
return this.fieldsToAttrs(copy(groups, true));
}),
});