Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit c38496b2 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

update UI on access-tokens

parent 014ab67e
No related branches found
No related tags found
No related merge requests found
......@@ -43,22 +43,22 @@
<table class="mat-elevation-z2" mat-table [dataSource]="data">
<ng-container matColumnDef="username">
<th mat-header-cell *matHeaderCellDef>username</th>
<th mat-header-cell *matHeaderCellDef>Username</th>
<td mat-cell *matCellDef="let row">{{row.username}}</td>
</ng-container>
<ng-container matColumnDef="fullName">
<th mat-header-cell *matHeaderCellDef>fullName</th>
<th mat-header-cell *matHeaderCellDef>Full name</th>
<td mat-cell *matCellDef="let row">{{row.fullName}}</td>
</ng-container>
<ng-container matColumnDef="roleType">
<th mat-header-cell *matHeaderCellDef>roleType</th>
<th mat-header-cell *matHeaderCellDef>Role type</th>
<td mat-cell *matCellDef="let row">{{row.roleType}}</td>
</ng-container>
<ng-container matColumnDef="memberOf">
<th mat-header-cell *matHeaderCellDef>memberOf</th>
<th mat-header-cell *matHeaderCellDef>Member of</th>
<td mat-cell *matCellDef="let row">{{row.memberOf}}</td>
</ng-container>
......
......@@ -57,7 +57,7 @@
<ng-template #searchDomainPanel>
<mat-form-field id="domain-filter">
<mat-label>Filter Domain by domain code</mat-label>
<input matInput (keyup)="applyDomainFilter($event)" placeholder="Domain code" #inputDomainFilter>
<input matInput (keyup)="applyDomainFilter($event)" #inputDomainFilter>
</mat-form-field>
<mat-toolbar class="mat-elevation-z2">
......
......@@ -4,7 +4,7 @@
<div class="panel" *ngIf="_domain!=null && !_domain.domainId"><p style="font-weight: bold">Enter data and click 'Save' to create new domain</div>
<mat-form-field style="width:100%">
<mat-label>Domain Code</mat-label>
<input matInput placeholder="Domain Code"
<input matInput
id="domainCode_id" #domainCode
matTooltip="The SMP's domain code. The code must be unique and is used in HTTP header 'Domain' or URL path sequence when retrieving/creating the resource using the webservice API"
formControlName="domainCode" maxlength="63"
......@@ -30,11 +30,10 @@
</mat-form-field>
<mat-form-field style="width:100%">
<mat-label>Response signature Certificate (Signature CertAlias)</mat-label>
<mat-select placeholder="Response signature Certificate (Signature CertAlias)"
formControlName="signatureKeyAlias"
<mat-select formControlName="signatureKeyAlias"
matTooltip="Certificate is used for signing REST responses for the domain."
id="signatureKeyAlias_id">
<mat-option [value]="''" disabled></mat-option>
<mat-option [value]="''" ></mat-option>
<mat-option *ngFor="let cert of keystoreCertificates" [value]="cert.alias">
{{cert.alias}} ({{cert.certificateId}})
</mat-option>
......@@ -45,12 +44,10 @@
<mat-form-field style="width:100%">
<mat-label>Visibility of the domain</mat-label>
<mat-select placeholder="Visibility of the domain"
formControlName="visibility"
<mat-select formControlName="visibility"
name="visibility"
matTooltip="Visibility of the domain."
id="domainVisibility_id">
<mat-option [value]="''" diabled>Choose visibility of the domain</mat-option>
<mat-option *ngFor="let visibility of domainVisibilityOptions"
[value]="visibility.value">
{{visibility.key}}
......@@ -63,8 +60,7 @@
<mat-form-field *ngIf="domainResourceTypes?.length" style="width:100%">
<mat-label>Default resource type for the domain</mat-label>
<mat-select placeholder="Default resource type for the domain"
formControlName="defaultResourceTypeIdentifier"
<mat-select formControlName="defaultResourceTypeIdentifier"
matTooltip="Default resource type for the domain."
id="domainDefaultResourceType_id">
<mat-option [value]="''" disabled></mat-option>
......
......@@ -5,7 +5,8 @@
<h3>SML integration data</h3>
<div class="panel" *ngIf="isDomainRegistered"><p style="font-weight: bold">Domain is registered to SML!</p>The Registered domain can not be deleted or changed the SMP SML identifier</div>
<mat-form-field style="width:100%">
<input matInput placeholder="SML domain"
<mat-label>SML domain</mat-label>
<input matInput
matTooltip="The domain-specific part of the SML DNS zone (e.g., ‘mydomain’ for mydomain.sml.dns.zone or leave empty for sml.dns.zone). Note: has informative value only, SML DNS zone used for publishing is based on SML configuration."
name="smlSubdomain"
id="smldomain_id"
......@@ -41,7 +42,7 @@
</mat-form-field>
<mat-form-field style="width:100%">
<mat-label>SML SMP identifier</mat-label>
<input matInput placeholder="SML SMP identifier" name="smlSmpId"
<input matInput name="smlSmpId"
id="smlSMPId_id" #smlSMPId
formControlName="smlSmpId"
(keydown)="onFieldKeyPressed('smlSmpId', 'smlsmpidTimeout')"
......@@ -71,7 +72,6 @@
matTooltip="Client Certificate used for SML authentication. The SML Client-Cert http Header is also generated from the certificate">
<mat-label>SML Client Certificate Alias</mat-label>
<mat-select
placeholder="SML ClientCert Alias"
formControlName="smlClientKeyAlias"
id="smlClientKeyAlias_id">
<mat-option [value]="''">Choose certificate for signing soap response</mat-option>
......
......@@ -68,7 +68,7 @@ if [[ -z "${SMP_VERSION}" ]]; then
fi
SMP_PLUGIN_EXAMPLE="../../smp-examples/smp-spi-example/target/"
SMP_PLUGIN_EXAMPLE="../../smp-examples/smp-spi-payload-validation-example/target/"
DIRNAME=$(dirname "$0")
cd "$DIRNAME"
......@@ -189,11 +189,11 @@ validateAndPrepareArtefacts() {
if [[ ! -f "${SMP_PLUGIN_EXAMPLE}" ]]; then
echo "SMP SPI plugin '${SMP_PLUGIN_EXAMPLE}' not found. copy from artefacts ${SMP_ARTEFACTS}!"
ls -ltr ${SMP_ARTEFACTS}
cp "${SMP_ARTEFACTS}/smp-spi-example-$SMP_VERSION.jar" ./tomcat-mysql-smp-sml/artefacts/smp-spi-example.jar
cp "${SMP_ARTEFACTS}/smp-spi-payload-validation-example-$SMP_VERSION.jar" ./tomcat-mysql-smp-sml/artefacts/smp-spi-payload-validation-example.jar
else
cp "${SMP_PLUGIN_EXAMPLE}/smp-spi-example-$SMP_VERSION.jar" ./tomcat-mysql-smp-sml/artefacts/smp-spi-example.jar
cp "${SMP_PLUGIN_EXAMPLE}/smp-spi-payload-validation-example-$SMP_VERSION.jar" ./tomcat-mysql-smp-sml/artefacts/smp-spi-payload-validation-example.jar
fi
}
# -----------------------------------------------------------------------------
# build docker images
......
......@@ -25,7 +25,7 @@
</properties>
<artifactId>smp-spi-payload-validation-example</artifactId>
<name>smp-spi-example</name>
<name>smp-spi-payload-validation-example</name>
<description>Example of SMP's SPI Payload validation.</description>
<dependencies>
<dependency>
......
......@@ -4,16 +4,17 @@ import eu.europa.ec.edelivery.smp.data.dao.*;
import eu.europa.ec.edelivery.smp.data.enums.VisibilityType;
import eu.europa.ec.edelivery.smp.data.model.DBDomain;
import eu.europa.ec.edelivery.smp.data.model.DBDomainResourceDef;
import eu.europa.ec.edelivery.smp.data.model.DBGroup;
import eu.europa.ec.edelivery.smp.data.model.ext.DBResourceDef;
import eu.europa.ec.edelivery.smp.data.model.user.DBDomainMember;
import eu.europa.ec.edelivery.smp.data.model.user.DBGroupMember;
import eu.europa.ec.edelivery.smp.data.ui.DomainRO;
import eu.europa.ec.edelivery.smp.data.ui.ResourceDefinitionRO;
import eu.europa.ec.edelivery.smp.data.ui.ServiceResult;
import eu.europa.ec.edelivery.smp.data.ui.enums.EntityROStatus;
import eu.europa.ec.edelivery.smp.exceptions.BadRequestException;
import eu.europa.ec.edelivery.smp.exceptions.ErrorBusinessCode;
import eu.europa.ec.edelivery.smp.logging.SMPLogger;
import eu.europa.ec.edelivery.smp.logging.SMPLoggerFactory;
import eu.europa.ec.edelivery.smp.sml.SmlConnector;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.convert.ConversionService;
import org.springframework.stereotype.Service;
......@@ -34,18 +35,31 @@ public class UIDomainService extends UIServiceBase<DBDomain, DomainRO> {
private DomainDao domainDao;
private DomainMemberDao domainMemberDao;
private ResourceDao resourceDao;
private ResourceDefDao resourceDefDao;
private DomainResourceDefDao domainResourceDefDao;
private ConversionService conversionService;
public UIDomainService(ConversionService conversionService, DomainDao domainDao, ResourceDao resourceDao, ResourceDefDao resourceDefDao, DomainResourceDefDao domainResourceDefDao) {
private GroupDao groupDao;
private GroupMemberDao groupMemberDao;
public UIDomainService(ConversionService conversionService,
DomainDao domainDao,
DomainMemberDao domainMemberDao,
ResourceDao resourceDao,
ResourceDefDao resourceDefDao,
DomainResourceDefDao domainResourceDefDao,
GroupDao groupDao,
GroupMemberDao groupMemberDao) {
this.conversionService = conversionService;
this.domainDao = domainDao;
this.resourceDao = resourceDao;
this.resourceDefDao = resourceDefDao;
this.domainResourceDefDao = domainResourceDefDao;
this.domainMemberDao = domainMemberDao;
this.groupDao = groupDao;
this.groupMemberDao = groupMemberDao;
}
@Override
......@@ -86,13 +100,14 @@ public class UIDomainService extends UIServiceBase<DBDomain, DomainRO> {
domain.setDomainCode(data.getDomainCode());
domain.setDefaultResourceTypeIdentifier(data.getDefaultResourceTypeIdentifier());
domain.setSignatureKeyAlias(data.getSignatureKeyAlias());
domain.setVisibility(data.getVisibility() == null? VisibilityType.PUBLIC:data.getVisibility());
domain.setVisibility(data.getVisibility() == null ? VisibilityType.PUBLIC : data.getVisibility());
domainDao.persistFlushDetach(domain);
}
/**
* Update only basic domain data from DomainRO object. Ignore other
*
* @param domainId
* @param data
* @return
......@@ -116,8 +131,8 @@ public class UIDomainService extends UIServiceBase<DBDomain, DomainRO> {
if (domain == null) {
throw new BadRequestException(ErrorBusinessCode.NOT_FOUND, "Domain does not exist in database!");
}
if (domain.isSmlRegistered() && !StringUtils.equals(data.getSmlSmpId(), domain.getSmlSmpId())){
String msg = "SMP-SML identifier must not change for registered domain ["+domain.getDomainCode()+"]!";
if (domain.isSmlRegistered() && !StringUtils.equals(data.getSmlSmpId(), domain.getSmlSmpId())) {
String msg = "SMP-SML identifier must not change for registered domain [" + domain.getDomainCode() + "]!";
throw new BadRequestException(ErrorBusinessCode.NOT_FOUND, msg);
}
......@@ -130,6 +145,7 @@ public class UIDomainService extends UIServiceBase<DBDomain, DomainRO> {
@Transactional
public void updateResourceDefDomainList(Long domainId, List<String> resourceDefIds) {
DBDomain domain = domainDao.find(domainId);
LOG.info("add resources: [{}]", resourceDefIds);
if (domain == null) {
LOG.warn("Can not delete domain for ID [{}], because it does not exists!", domainId);
throw new BadRequestException(ErrorBusinessCode.NOT_FOUND, "Domain does not exist in database!");
......@@ -155,14 +171,14 @@ public class UIDomainService extends UIServiceBase<DBDomain, DomainRO> {
@Transactional
public DomainRO getDomainData(Long domainId){
DBDomain domain = domainDao.find(domainId);
public DomainRO getDomainData(Long domainId) {
DBDomain domain = domainDao.find(domainId);
return conversionService.convert(domain, DomainRO.class);
}
@Transactional
public DomainRO getDomainDataByDomainCode(String domainCode){
DBDomain domain = domainDao.getDomainByCode(domainCode).orElse(null);
public DomainRO getDomainDataByDomainCode(String domainCode) {
DBDomain domain = domainDao.getDomainByCode(domainCode).orElse(null);
return conversionService.convert(domain, DomainRO.class);
}
......@@ -196,11 +212,31 @@ public class UIDomainService extends UIServiceBase<DBDomain, DomainRO> {
throw new BadRequestException(ErrorBusinessCode.INVALID_INPUT_DATA, "Can not delete domain because it has resources [" + count + "]! Delete resources first!");
}
// if there are no resources / just "unpin" the members and the groups
List<DBDomainMember> memberList = domainMemberDao.getDomainMembers(domain.getId(), -1, -1, null);
for (DBDomainMember member : memberList) {
domainMemberDao.remove(member);
}
// delete all groups
List<DBGroup> groupList = domain.getDomainGroups();
for (DBGroup group : groupList) {
// all groups should be without resources see the check above: getResourceCountForDomain
deleteDomainGroup(group);
}
// finally remove the domain
domainDao.remove(domain);
DomainRO domainRO = conversionService.convert(domain, DomainRO.class);
domainRO.setStatus(EntityROStatus.REMOVE.getStatusNumber());
return domainRO;
}
private void deleteDomainGroup(DBGroup group) {
List<DBGroupMember> memberList = groupMemberDao.getGroupMembers(group.getId(), -1, -1, null);
for (DBGroupMember member : memberList) {
groupMemberDao.remove(member);
}
groupDao.remove(group);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment