From c2356dc36977c1608481f3114b022532cbb94fe6 Mon Sep 17 00:00:00 2001
From: Joze RIHTARSIC <joze.rihtarsic@ext.ec.europa.eu>
Date: Fri, 30 Nov 2018 06:13:34 +0100
Subject: [PATCH] Fix sql migration scrip for mysql UI disable domain item if
 is not configured properly

---
 ...ervice-group-details-dialog.component.html |   2 +-
 .../service-group-details-dialog.component.ts |   9 +++++++++
 .../mysql5innoDb_4.0_to_4.1.sql               |   4 ++--
 .../oracle10g_4.0_to_4.1.sql                  |   8 ++++----
 .../smp-keystore_multiple_domains.jks         | Bin 62596 -> 65202 bytes
 5 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.html b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.html
index 9b0d8901b..e751dae6d 100644
--- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.html
+++ b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.html
@@ -105,7 +105,7 @@
                                    (selectionChange)="onDomainSelectionChanged($event)"
                                    style="height: 200px;  overflow-y: scroll; overflow-x: auto;">
                 <mat-list-option *ngFor="let domain of lookups.cachedDomainList" [value]='domain'
-                                 style="max-width: 450px !important; word-wrap: break-word !important; height: auto; min-height: 30px !important;">
+                                 style="max-width: 450px !important; word-wrap: break-word !important; height: auto; min-height: 30px !important;" [disabled]="!isDomainProperlyConfigured(domain)">
                   {{domain.domainCode}} ({{domain.smlSubdomain}})
                 </mat-list-option>
               </mat-selection-list>
diff --git a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.ts b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.ts
index 4ceaf7702..8feb2a986 100644
--- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.ts
+++ b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.ts
@@ -132,6 +132,15 @@ export class ServiceGroupDetailsDialogComponent implements OnInit {
     this.changeDetector.detectChanges()
   }
 
+  isDomainProperlyConfigured(domain: DomainRo){
+    if (this.lookups.cachedApplicationInfo.smlIntegrationOn) {
+      return domain.smlSmpId && (domain.smlClientKeyAlias || domain.smlClientCertHeader);
+    } else {
+      return true;
+    }
+
+  }
+
 
   submitForm() {
     this.checkValidity(this.dialogForm);
diff --git a/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.0.x to 4.1.0/mysql5innoDb_4.0_to_4.1.sql b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.0.x to 4.1.0/mysql5innoDb_4.0_to_4.1.sql
index a704070f8..050a8452b 100644
--- a/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.0.x to 4.1.0/mysql5innoDb_4.0_to_4.1.sql	
+++ b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.0.x to 4.1.0/mysql5innoDb_4.0_to_4.1.sql	
@@ -52,7 +52,7 @@ alter table smp_user rename to SMP_USER_BCK;
         SML_SMP_ID varchar(256)  CHARACTER SET utf8 COLLATE utf8_bin,
         SML_SUBDOMAIN varchar(256)  CHARACTER SET utf8 COLLATE utf8_bin,
         SML_REGISTERED bit,
-        SML_BLUE_COAT_AUTH bit;
+        SML_BLUE_COAT_AUTH bit,
         primary key (ID)
     ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
@@ -70,7 +70,7 @@ alter table smp_user rename to SMP_USER_BCK;
         SML_SMP_ID varchar(256)  CHARACTER SET utf8 COLLATE utf8_bin,
         SML_SUBDOMAIN varchar(256)  CHARACTER SET utf8 COLLATE utf8_bin,
         SML_REGISTERED bit,
-        SML_BLUE_COAT_AUTH bit;
+        SML_BLUE_COAT_AUTH bit,
         primary key (ID, REV)
     ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
diff --git a/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.0.x to 4.1.0/oracle10g_4.0_to_4.1.sql b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.0.x to 4.1.0/oracle10g_4.0_to_4.1.sql
index dd52f2725..497d1e5ce 100644
--- a/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.0.x to 4.1.0/oracle10g_4.0_to_4.1.sql	
+++ b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.0.x to 4.1.0/oracle10g_4.0_to_4.1.sql	
@@ -13,10 +13,10 @@ alter table SMP_USER rename to SMP_USER_BCK;
 -- --------------------------------------------------------------------------------------------------------- 
 create sequence SMP_DOMAIN_SEQ start with 1 increment by  1;
 create sequence SMP_REVISION_SEQ start with 1 increment by  1;
-create sequence SMP_SERVICE_GROUP_DOMAIN_SEQ start with 1 increment by  50;
-create sequence SMP_SERVICE_GROUP_SEQ start with 1 increment by  50;
-create sequence SMP_SERVICE_METADATA_SEQ start with 1 increment by  50;
-create sequence SMP_USER_SEQ start with 1 increment by  50;
+create sequence SMP_SERVICE_GROUP_DOMAIN_SEQ start with 1 increment by  1;
+create sequence SMP_SERVICE_GROUP_SEQ start with 1 increment by  1;
+create sequence SMP_SERVICE_METADATA_SEQ start with 1 increment by  1;
+create sequence SMP_USER_SEQ start with 1 increment by  1;
 
     create table SMP_CERTIFICATE (
        ID number(19,0) not null,
diff --git a/smp-webapp/src/test/resources/keystores/smp-keystore_multiple_domains.jks b/smp-webapp/src/test/resources/keystores/smp-keystore_multiple_domains.jks
index 349a9a10107127e59243beb1e1f3caf669b80f5d..c09e75a016ca3d746829484f349d4bfeb67f74cf 100644
GIT binary patch
delta 1442
zcmV;T1zq}t=>xL;0}TG{{_Ow&00IC205X%I#u~9ESWF5uH~;_vXJZEUd6RKR9DnU;
zgWC<$sWka$k>rzH$2idq9g$y5(4;(gZuBjo^)Zv$23eDGGqn*4Yx%E#W4fI_ODa@)
zu>1I8H|ne2d+d%;c2MGO9oqT0Cz2FzXJ|F)M*ak9<3ezT9vc*cFJ2a-I0KLn>=jO^
ztFZXAYCwiVzJY8-cMu~)z&S*VJAa*AyrX{+qn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