diff --git a/pom.xml b/pom.xml index 88a154fb9b7abe3f6a4b825919ac4a653d00c91b..1d6b279c055c7b2ac6473b1546ce014ef4596ac5 100644 --- a/pom.xml +++ b/pom.xml @@ -66,6 +66,7 @@ <jackson.version>2.13.2</jackson.version> <javaee-api.version>7.0</javaee-api.version> <javax.annotation.version>1.3.2</javax.annotation.version> + <javax.mail.version>1.6.2</javax.mail.version> <jaxb.version>2.2.11</jaxb.version> <jaxb2-basics.version>1.11.1</jaxb2-basics.version> <jstl.version>1.2</jstl.version> @@ -388,7 +389,7 @@ <dependency> <groupId>com.sun.mail</groupId> <artifactId>javax.mail</artifactId> - <version>1.6.2</version> + <version>${javax.mail.version}</version> </dependency> <dependency> <groupId>org.mockito</groupId> diff --git a/smp-angular/src/app/domain/domain.component.ts b/smp-angular/src/app/domain/domain.component.ts index 58f9acffc81d47d5848faa63f6fdc2942a78a561..6f57cccb9d5f86e28b22145b812893cc54dec1ca 100644 --- a/smp-angular/src/app/domain/domain.component.ts +++ b/smp-angular/src/app/domain/domain.component.ts @@ -1,4 +1,4 @@ -import {AfterViewInit, Component, OnInit, TemplateRef, ViewChild} from '@angular/core'; +import {AfterViewInit, Component, TemplateRef, ViewChild} from '@angular/core'; import {ColumnPicker} from '../common/column-picker/column-picker.model'; import {MatDialog, MatDialogRef} from '@angular/material/dialog'; @@ -14,7 +14,6 @@ import {ConfirmationDialogComponent} from "../common/confirmation-dialog/confirm import {SearchTableEntityStatus} from "../common/search-table/search-table-entity-status.model"; import {KeystoreEditDialogComponent} from "./keystore-edit-dialog/keystore-edit-dialog.component"; import {SmpInfoService} from "../app-info/smp-info.service"; -import {SmpInfo} from "../app-info/smp-info.model"; import {SmlIntegrationService} from "./sml-integration.service"; import {SMLResult} from "./sml-result.model"; @@ -36,8 +35,6 @@ export class DomainComponent implements AfterViewInit { columnPicker: ColumnPicker = new ColumnPicker(); domainController: DomainController; filter: any = {}; - isSMPIntegrationOn: boolean = false; - constructor(public securityService: SecurityService, protected smpInfoService: SmpInfoService, @@ -48,11 +45,8 @@ export class DomainComponent implements AfterViewInit { public dialog: MatDialog) { // check application settings - this.isSMPIntegrationOn = this.lookups.cachedApplicationConfig.smlIntegrationOn - // if system admin refresh certificate list! - if (this.securityService.isCurrentUserSystemAdmin()) { - this.lookups.refreshCertificateLookup(); - } + + } ngAfterViewInit() { @@ -112,6 +106,12 @@ export class DomainComponent implements AfterViewInit { ]; this.searchTable.tableColumnInit(); this.columnPicker.selectedColumns = this.columnPicker.allColumns.filter(col => col.showInitially); + + // if system admin refresh certificate list! + if (this.securityService.isCurrentUserSystemAdmin()) { + this.lookups.refreshCertificateLookup(); + } + } certificateAliasExists(alias: string): boolean { @@ -146,14 +146,15 @@ export class DomainComponent implements AfterViewInit { return 'deleted'; } } + getDomainConfigurationWarning(domain: DomainRo) { - let msg =null; + let msg = null; if (!domain.signatureKeyAlias) { msg = "The domain should have a defined signature CertAlias." } if (this.lookups.cachedApplicationConfig.smlIntegrationOn) { - if( !domain.smlSmpId || !domain.smlClientCertHeader){ - msg = (!msg?"": msg+" ") + "For SML integration the SMP SMP ID and SML client certificate must be defined!" + if (!domain.smlSmpId || !domain.smlClientCertHeader) { + msg = (!msg ? "" : msg + " ") + "For SML integration the SMP SMP ID and SML client certificate must be defined!" } } return msg; @@ -167,6 +168,9 @@ export class DomainComponent implements AfterViewInit { isDirty(): boolean { return this.searchTable.isDirty(); } + get isSMPIntegrationOn(){ + return this.lookups.cachedApplicationConfig?.smlIntegrationOn + } enableSMLRegister(): boolean { if (!this.selectedOneRow || !this.isSMPIntegrationOn) { @@ -189,7 +193,7 @@ export class DomainComponent implements AfterViewInit { } enableSMLUnregister(): boolean { - if ( !this.selectedOneRow || !this.isSMPIntegrationOn) { + if (!this.selectedOneRow || !this.isSMPIntegrationOn) { return false; } let domainRo = (this.searchTable.selected[0] as DomainRo); @@ -209,7 +213,7 @@ export class DomainComponent implements AfterViewInit { return domainRo.smlRegistered; } - get selectedOneRow() : boolean{ + get selectedOneRow(): boolean { return this.searchTable?.selected.length === 1 } @@ -252,9 +256,9 @@ export class DomainComponent implements AfterViewInit { } smlRegisterDomain(domain: DomainRo) { - this.searchTable.showSpinner=true; + this.searchTable.showSpinner = true; this.smlIntegrationService.registerDomainToSML$(domain.domainCode).toPromise().then((res: SMLResult) => { - this.searchTable.showSpinner=false; + this.searchTable.showSpinner = false; if (res) { if (res.success) { this.alertService.success("Domain " + domain.domainCode + " registered to sml!"); @@ -268,16 +272,16 @@ export class DomainComponent implements AfterViewInit { } }, err => { - this.searchTable.showSpinner=false; + this.searchTable.showSpinner = false; this.alertService.exception('Error occurred while registering domain:' + domain.domainCode, err); } ) } smlUnregisterDomain(domain: DomainRo) { - this.searchTable.showSpinner=true; + this.searchTable.showSpinner = true; this.smlIntegrationService.unregisterDomainToSML$(domain.domainCode).toPromise().then((res: SMLResult) => { - this.searchTable.showSpinner=false; + this.searchTable.showSpinner = false; if (res) { if (res.success) { this.alertService.success("Domain " + domain.domainCode + " unregistered from sml!"); @@ -292,7 +296,7 @@ export class DomainComponent implements AfterViewInit { } , err => { - this.searchTable.showSpinner=false; + this.searchTable.showSpinner = false; this.alertService.exception('Error occurred while unregistering domain:' + domain.domainCode, err); } )