NIFI-12481: Filtering out unauthorized registry clients to avoid unhandled error (#8147)

* NIFI-12481:
- Filtering out unauthorized registry clients to avoid unhandled error.

* NIFI-12481:
- Using es5 syntax.

This closes #8147
This commit is contained in:
Matt Gilman 2023-12-21 11:34:57 -05:00 committed by GitHub
parent e6d09c3b3d
commit 1f54d5d1fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 3 deletions

View File

@ -198,12 +198,19 @@
}).done(function (registriesResponse) {
var registries = [];
if (nfCommon.isDefinedAndNotNull(registriesResponse.registries) && registriesResponse.registries.length > 0) {
registriesResponse.registries.sort(function (a, b) {
var authorizedRegistries = [];
if (nfCommon.isDefinedAndNotNull(registriesResponse.registries)) {
authorizedRegistries = registriesResponse.registries.filter(function(registry) {
return registry.permissions.canRead;
});
}
if (authorizedRegistries.length > 0) {
authorizedRegistries.sort(function (a, b) {
return a.component.name > b.component.name;
});
$.each(registriesResponse.registries, function (_, registryEntity) {
$.each(authorizedRegistries, function (_, registryEntity) {
var registry = registryEntity.component;
registries.push({
text: registry.name,