add tenant configuration
This commit is contained in:
parent
8e9fee55aa
commit
26bdabe03b
|
@ -168,6 +168,11 @@ public final class Permission {
|
|||
public static String DeleteTenant = "DeleteTenant";
|
||||
public static String AllowNoTenant = "AllowNoTenant";
|
||||
|
||||
//TenantConfiguration
|
||||
public static String BrowseTenantConfiguration = "BrowseTenantConfiguration";
|
||||
public static String EditTenantConfiguration = "EditTenantConfiguration";
|
||||
public static String DeleteTenantConfiguration = "DeleteTenantConfiguration";
|
||||
|
||||
//TenantUser
|
||||
public static String BrowseTenantUser = "BrowseTenantUser";
|
||||
public static String EditTenantUser = "EditTenantUser";
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package eu.eudat.commons.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public enum TenantConfigurationType implements DatabaseEnum<Short> {
|
||||
|
||||
DepositPlugins((short) 0),
|
||||
FileTransformerPlugins((short) 1),
|
||||
DefaultUserLocale((short) 2),
|
||||
Logo((short) 3),
|
||||
CssColors((short) 4);
|
||||
|
||||
private final Short value;
|
||||
|
||||
TenantConfigurationType(Short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Short getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
private static final Map<Short, TenantConfigurationType> map = EnumUtils.getEnumValueMap(TenantConfigurationType.class);
|
||||
|
||||
public static TenantConfigurationType of(Short i) {
|
||||
return map.get(i);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package eu.eudat.commons.types.deposit;
|
||||
|
||||
public class DepositSourceEntity {
|
||||
|
||||
private String repositoryId;
|
||||
private String url;
|
||||
private String issuerUrl;
|
||||
private String clientId;
|
||||
private String clientSecret;
|
||||
private String scope;
|
||||
private String pdfTransformerId;
|
||||
private String rdaTransformerId;
|
||||
|
||||
public String getRepositoryId() {
|
||||
return repositoryId;
|
||||
}
|
||||
|
||||
public void setRepositoryId(String repositoryId) {
|
||||
this.repositoryId = repositoryId;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getIssuerUrl() {
|
||||
return issuerUrl;
|
||||
}
|
||||
|
||||
public void setIssuerUrl(String issuerUrl) {
|
||||
this.issuerUrl = issuerUrl;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientSecret() {
|
||||
return clientSecret;
|
||||
}
|
||||
|
||||
public void setClientSecret(String clientSecret) {
|
||||
this.clientSecret = clientSecret;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getPdfTransformerId() {
|
||||
return pdfTransformerId;
|
||||
}
|
||||
|
||||
public void setPdfTransformerId(String pdfTransformerId) {
|
||||
this.pdfTransformerId = pdfTransformerId;
|
||||
}
|
||||
|
||||
public String getRdaTransformerId() {
|
||||
return rdaTransformerId;
|
||||
}
|
||||
|
||||
public void setRdaTransformerId(String rdaTransformerId) {
|
||||
this.rdaTransformerId = rdaTransformerId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package eu.eudat.commons.types.filetransformer;
|
||||
|
||||
public class FileTransformerSourceEntity {
|
||||
|
||||
private String url;
|
||||
private String transformerId;
|
||||
private String issuerUrl;
|
||||
private String clientId;
|
||||
private String clientSecret;
|
||||
private String scope;
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getTransformerId() {
|
||||
return transformerId;
|
||||
}
|
||||
|
||||
public void setTransformerId(String transformerId) {
|
||||
this.transformerId = transformerId;
|
||||
}
|
||||
|
||||
public String getIssuerUrl() {
|
||||
return issuerUrl;
|
||||
}
|
||||
|
||||
public void setIssuerUrl(String issuerUrl) {
|
||||
this.issuerUrl = issuerUrl;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientSecret() {
|
||||
return clientSecret;
|
||||
}
|
||||
|
||||
public void setClientSecret(String clientSecret) {
|
||||
this.clientSecret = clientSecret;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package eu.eudat.commons.types.tenantconfiguration;
|
||||
|
||||
public class CssColorsTenantConfigurationEntity {
|
||||
private String primaryColor;
|
||||
private String primaryColor2;
|
||||
private String primaryColor3;
|
||||
private String secondaryColor;
|
||||
|
||||
public String getPrimaryColor() {
|
||||
return primaryColor;
|
||||
}
|
||||
|
||||
public void setPrimaryColor(String primaryColor) {
|
||||
this.primaryColor = primaryColor;
|
||||
}
|
||||
|
||||
public String getPrimaryColor2() {
|
||||
return primaryColor2;
|
||||
}
|
||||
|
||||
public void setPrimaryColor2(String primaryColor2) {
|
||||
this.primaryColor2 = primaryColor2;
|
||||
}
|
||||
|
||||
public String getPrimaryColor3() {
|
||||
return primaryColor3;
|
||||
}
|
||||
|
||||
public void setPrimaryColor3(String primaryColor3) {
|
||||
this.primaryColor3 = primaryColor3;
|
||||
}
|
||||
|
||||
public String getSecondaryColor() {
|
||||
return secondaryColor;
|
||||
}
|
||||
|
||||
public void setSecondaryColor(String secondaryColor) {
|
||||
this.secondaryColor = secondaryColor;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package eu.eudat.commons.types.tenantconfiguration;
|
||||
|
||||
public class DefaultUserLocaleTenantConfigurationEntity {
|
||||
private String timezone;
|
||||
private String language;
|
||||
private String culture;
|
||||
|
||||
public String getTimezone() {
|
||||
return timezone;
|
||||
}
|
||||
|
||||
public void setTimezone(String timezone) {
|
||||
this.timezone = timezone;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public String getCulture() {
|
||||
return culture;
|
||||
}
|
||||
|
||||
public void setCulture(String culture) {
|
||||
this.culture = culture;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package eu.eudat.commons.types.tenantconfiguration;
|
||||
|
||||
import eu.eudat.commons.types.deposit.DepositSourceEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DepositTenantConfigurationEntity {
|
||||
private List<DepositSourceEntity> sources;
|
||||
|
||||
public List<DepositSourceEntity> getSources() {
|
||||
return sources;
|
||||
}
|
||||
|
||||
public void setSources(List<DepositSourceEntity> sources) {
|
||||
this.sources = sources;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package eu.eudat.commons.types.tenantconfiguration;
|
||||
|
||||
import eu.eudat.commons.types.filetransformer.FileTransformerSourceEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FileTransformerTenantConfigurationEntity {
|
||||
|
||||
private List<FileTransformerSourceEntity> sources;
|
||||
|
||||
public List<FileTransformerSourceEntity> getSources() {
|
||||
return sources;
|
||||
}
|
||||
|
||||
public void setSources(List<FileTransformerSourceEntity> sources) {
|
||||
this.sources = sources;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package eu.eudat.commons.types.tenantconfiguration;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class LogoTenantConfigurationEntity {
|
||||
private UUID storageFileId;
|
||||
|
||||
public UUID getStorageFileId() {
|
||||
return storageFileId;
|
||||
}
|
||||
|
||||
public void setStorageFileId(UUID storageFileId) {
|
||||
this.storageFileId = storageFileId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package eu.eudat.data;
|
||||
|
||||
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.enums.TenantConfigurationType;
|
||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||
import eu.eudat.data.converters.enums.TenantConfigurationTypeConverter;
|
||||
import eu.eudat.data.tenant.TenantScopedBaseEntity;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"TenantConfiguration\"")
|
||||
public class TenantConfigurationEntity extends TenantScopedBaseEntity {
|
||||
|
||||
@Id
|
||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||
private UUID id;
|
||||
public final static String _id = "id";
|
||||
|
||||
@Column(name = "value", nullable = false)
|
||||
private String value;
|
||||
public final static String _value = "value";
|
||||
|
||||
@Column(name = "type", nullable = false)
|
||||
@Convert(converter = TenantConfigurationTypeConverter.class)
|
||||
private TenantConfigurationType type;
|
||||
public final static String _type = "type";
|
||||
|
||||
@Column(name = "is_active", nullable = false)
|
||||
@Convert(converter = IsActiveConverter.class)
|
||||
private IsActive isActive;
|
||||
public final static String _isActive = "isActive";
|
||||
|
||||
@Column(name = "created_at", nullable = false)
|
||||
private Instant createdAt;
|
||||
public final static String _createdAt = "createdAt";
|
||||
|
||||
@Column(name = "updated_at", nullable = false)
|
||||
private Instant updatedAt;
|
||||
public final static String _updatedAt = "updatedAt";
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public TenantConfigurationType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(TenantConfigurationType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public IsActive getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setIsActive(IsActive isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public Instant getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Instant getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Instant updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package eu.eudat.data.converters.enums;
|
||||
|
||||
import eu.eudat.commons.enums.TenantConfigurationType;
|
||||
import jakarta.persistence.Converter;
|
||||
|
||||
@Converter
|
||||
public class TenantConfigurationTypeConverter extends DatabaseEnumConverter<TenantConfigurationType, Short> {
|
||||
public TenantConfigurationType of(Short i) {
|
||||
return TenantConfigurationType.of(i);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package eu.eudat.model.censorship.deposit;
|
||||
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.model.censorship.BaseCensor;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.fieldset.FieldSet;
|
||||
import gr.cite.tools.logging.DataLogEntry;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DepositSourceCensor extends BaseCensor {
|
||||
|
||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DepositSourceCensor.class));
|
||||
|
||||
protected final AuthorizationService authService;
|
||||
|
||||
|
||||
public DepositSourceCensor(ConventionService conventionService, AuthorizationService authService) {
|
||||
super(conventionService);
|
||||
this.authService = authService;
|
||||
}
|
||||
|
||||
public void censor(FieldSet fields, UUID userId) {
|
||||
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
this.authService.authorize(Permission.BrowseTenantConfiguration);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package eu.eudat.model.censorship.filetransformer;
|
||||
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.model.censorship.BaseCensor;
|
||||
import eu.eudat.model.censorship.deposit.DepositSourceCensor;
|
||||
import eu.eudat.model.tenantconfiguration.DepositTenantConfiguration;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.fieldset.FieldSet;
|
||||
import gr.cite.tools.logging.DataLogEntry;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class FileTransformerSourceCensor extends BaseCensor {
|
||||
|
||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(FileTransformerSourceCensor.class));
|
||||
|
||||
protected final AuthorizationService authService;
|
||||
|
||||
|
||||
public FileTransformerSourceCensor(ConventionService conventionService, AuthorizationService authService) {
|
||||
super(conventionService);
|
||||
this.authService = authService;
|
||||
}
|
||||
|
||||
public void censor(FieldSet fields, UUID userId) {
|
||||
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
this.authService.authorize(Permission.BrowseTenantConfiguration);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package eu.eudat.model.censorship.tenantconfiguration;
|
||||
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.model.censorship.BaseCensor;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.fieldset.FieldSet;
|
||||
import gr.cite.tools.logging.DataLogEntry;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class CssColorsTenantConfigurationCensor extends BaseCensor {
|
||||
|
||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(CssColorsTenantConfigurationCensor.class));
|
||||
|
||||
protected final AuthorizationService authService;
|
||||
|
||||
|
||||
public CssColorsTenantConfigurationCensor(ConventionService conventionService, AuthorizationService authService) {
|
||||
super(conventionService);
|
||||
this.authService = authService;
|
||||
}
|
||||
|
||||
public void censor(FieldSet fields, UUID userId) {
|
||||
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
this.authService.authorize(Permission.BrowseTenantConfiguration);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package eu.eudat.model.censorship.tenantconfiguration;
|
||||
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.model.censorship.BaseCensor;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.fieldset.FieldSet;
|
||||
import gr.cite.tools.logging.DataLogEntry;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DefaultUserLocaleTenantConfigurationCensor extends BaseCensor {
|
||||
|
||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DefaultUserLocaleTenantConfigurationCensor.class));
|
||||
|
||||
protected final AuthorizationService authService;
|
||||
|
||||
|
||||
public DefaultUserLocaleTenantConfigurationCensor(ConventionService conventionService, AuthorizationService authService) {
|
||||
super(conventionService);
|
||||
this.authService = authService;
|
||||
}
|
||||
|
||||
public void censor(FieldSet fields, UUID userId) {
|
||||
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
this.authService.authorize(Permission.BrowseTenantConfiguration);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package eu.eudat.model.censorship.tenantconfiguration;
|
||||
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.model.censorship.BaseCensor;
|
||||
import eu.eudat.model.censorship.deposit.DepositSourceCensor;
|
||||
import eu.eudat.model.tenantconfiguration.DepositTenantConfiguration;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.data.censor.CensorFactory;
|
||||
import gr.cite.tools.fieldset.FieldSet;
|
||||
import gr.cite.tools.logging.DataLogEntry;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DepositTenantConfigurationCensor extends BaseCensor {
|
||||
|
||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DepositTenantConfigurationCensor.class));
|
||||
|
||||
protected final AuthorizationService authService;
|
||||
|
||||
protected final CensorFactory censorFactory;
|
||||
|
||||
|
||||
public DepositTenantConfigurationCensor(ConventionService conventionService, AuthorizationService authService, CensorFactory censorFactory) {
|
||||
super(conventionService);
|
||||
this.authService = authService;
|
||||
this.censorFactory = censorFactory;
|
||||
}
|
||||
|
||||
public void censor(FieldSet fields, UUID userId) {
|
||||
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
this.authService.authorize(Permission.BrowseTenantConfiguration);
|
||||
|
||||
FieldSet sourcesFields = fields.extractPrefixed(this.asIndexerPrefix(DepositTenantConfiguration._sources));
|
||||
this.censorFactory.censor(DepositSourceCensor.class).censor(sourcesFields, userId);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package eu.eudat.model.censorship.tenantconfiguration;
|
||||
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.model.censorship.BaseCensor;
|
||||
import eu.eudat.model.censorship.deposit.DepositSourceCensor;
|
||||
import eu.eudat.model.censorship.filetransformer.FileTransformerSourceCensor;
|
||||
import eu.eudat.model.filetransformer.FileTransformerSource;
|
||||
import eu.eudat.model.tenantconfiguration.DepositTenantConfiguration;
|
||||
import eu.eudat.model.tenantconfiguration.FileTransformerTenantConfiguration;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.data.censor.CensorFactory;
|
||||
import gr.cite.tools.fieldset.FieldSet;
|
||||
import gr.cite.tools.logging.DataLogEntry;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class FileTransformerTenantConfigurationCensor extends BaseCensor {
|
||||
|
||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(FileTransformerTenantConfigurationCensor.class));
|
||||
|
||||
protected final AuthorizationService authService;
|
||||
|
||||
protected final CensorFactory censorFactory;
|
||||
|
||||
|
||||
public FileTransformerTenantConfigurationCensor(ConventionService conventionService, AuthorizationService authService, CensorFactory censorFactory) {
|
||||
super(conventionService);
|
||||
this.authService = authService;
|
||||
this.censorFactory = censorFactory;
|
||||
}
|
||||
|
||||
public void censor(FieldSet fields, UUID userId) {
|
||||
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
this.authService.authorize(Permission.BrowseTenantConfiguration);
|
||||
|
||||
FieldSet sourcesFields = fields.extractPrefixed(this.asIndexerPrefix(FileTransformerTenantConfiguration._sources));
|
||||
this.censorFactory.censor(FileTransformerSourceCensor.class).censor(sourcesFields, userId);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package eu.eudat.model.censorship.tenantconfiguration;
|
||||
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.model.censorship.BaseCensor;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.fieldset.FieldSet;
|
||||
import gr.cite.tools.logging.DataLogEntry;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class LogoTenantConfigurationCensor extends BaseCensor {
|
||||
|
||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(LogoTenantConfigurationCensor.class));
|
||||
|
||||
protected final AuthorizationService authService;
|
||||
|
||||
|
||||
public LogoTenantConfigurationCensor(ConventionService conventionService, AuthorizationService authService) {
|
||||
super(conventionService);
|
||||
this.authService = authService;
|
||||
}
|
||||
|
||||
public void censor(FieldSet fields, UUID userId) {
|
||||
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
this.authService.authorize(Permission.BrowseTenantConfiguration);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package eu.eudat.model.censorship.tenantconfiguration;
|
||||
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.model.Description;
|
||||
import eu.eudat.model.censorship.BaseCensor;
|
||||
import eu.eudat.model.censorship.DescriptionReferenceCensor;
|
||||
import eu.eudat.model.tenantconfiguration.TenantConfiguration;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.data.censor.CensorFactory;
|
||||
import gr.cite.tools.fieldset.FieldSet;
|
||||
import gr.cite.tools.logging.DataLogEntry;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class TenantConfigurationCensor extends BaseCensor {
|
||||
|
||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(TenantConfigurationCensor.class));
|
||||
|
||||
protected final AuthorizationService authService;
|
||||
|
||||
protected final CensorFactory censorFactory;
|
||||
|
||||
|
||||
public TenantConfigurationCensor(ConventionService conventionService, AuthorizationService authService, CensorFactory censorFactory) {
|
||||
super(conventionService);
|
||||
this.authService = authService;
|
||||
this.censorFactory = censorFactory;
|
||||
}
|
||||
|
||||
public void censor(FieldSet fields, UUID userId) {
|
||||
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
this.authService.authorize(Permission.BrowseTenantConfiguration);
|
||||
|
||||
FieldSet cssColorsFields = fields.extractPrefixed(this.asIndexerPrefix(TenantConfiguration._cssColors));
|
||||
this.censorFactory.censor(CssColorsTenantConfigurationCensor.class).censor(cssColorsFields, userId);
|
||||
|
||||
FieldSet defaultUserLocaleFields = fields.extractPrefixed(this.asIndexerPrefix(TenantConfiguration._defaultUserLocale));
|
||||
this.censorFactory.censor(DefaultUserLocaleTenantConfigurationCensor.class).censor(defaultUserLocaleFields, userId);
|
||||
|
||||
FieldSet depositPluginsFields = fields.extractPrefixed(this.asIndexerPrefix(TenantConfiguration._depositPlugins));
|
||||
this.censorFactory.censor(DepositTenantConfigurationCensor.class).censor(depositPluginsFields, userId);
|
||||
|
||||
FieldSet fileTransformerPluginsFields = fields.extractPrefixed(this.asIndexerPrefix(TenantConfiguration._fileTransformerPlugins));
|
||||
this.censorFactory.censor(FileTransformerTenantConfigurationCensor.class).censor(fileTransformerPluginsFields, userId);
|
||||
|
||||
FieldSet logoFields = fields.extractPrefixed(this.asIndexerPrefix(TenantConfiguration._logo));
|
||||
this.censorFactory.censor(LogoTenantConfigurationCensor.class).censor(logoFields, userId);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package eu.eudat.model.deposit;
|
||||
|
||||
public class DepositSource {
|
||||
|
||||
private String repositoryId;
|
||||
public static final String _repositoryId = "repositoryId";
|
||||
private String url;
|
||||
public static final String _url = "url";
|
||||
private String issuerUrl;
|
||||
public static final String _issuerUrl = "issuerUrl";
|
||||
private String clientId;
|
||||
public static final String _clientId = "clientId";
|
||||
private String clientSecret;
|
||||
public static final String _clientSecret = "clientSecret";
|
||||
private String scope;
|
||||
public static final String _scope = "scope";
|
||||
private String pdfTransformerId;
|
||||
public static final String _pdfTransformerId = "pdfTransformerId";
|
||||
private String rdaTransformerId;
|
||||
public static final String _rdaTransformerId = "rdaTransformerId";
|
||||
|
||||
public String getRepositoryId() {
|
||||
return repositoryId;
|
||||
}
|
||||
|
||||
public void setRepositoryId(String repositoryId) {
|
||||
this.repositoryId = repositoryId;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getIssuerUrl() {
|
||||
return issuerUrl;
|
||||
}
|
||||
|
||||
public void setIssuerUrl(String issuerUrl) {
|
||||
this.issuerUrl = issuerUrl;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientSecret() {
|
||||
return clientSecret;
|
||||
}
|
||||
|
||||
public void setClientSecret(String clientSecret) {
|
||||
this.clientSecret = clientSecret;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getPdfTransformerId() {
|
||||
return pdfTransformerId;
|
||||
}
|
||||
|
||||
public void setPdfTransformerId(String pdfTransformerId) {
|
||||
this.pdfTransformerId = pdfTransformerId;
|
||||
}
|
||||
|
||||
public String getRdaTransformerId() {
|
||||
return rdaTransformerId;
|
||||
}
|
||||
|
||||
public void setRdaTransformerId(String rdaTransformerId) {
|
||||
this.rdaTransformerId = rdaTransformerId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package eu.eudat.model.filetransformer;
|
||||
|
||||
public class FileTransformerSource {
|
||||
|
||||
private String url;
|
||||
public static final String _url = "url";
|
||||
private String transformerId;
|
||||
public static final String _transformerId = "transformerId";
|
||||
private String issuerUrl;
|
||||
public static final String _issuerUrl = "issuerUrl";
|
||||
private String clientId;
|
||||
public static final String _clientId = "clientId";
|
||||
private String clientSecret;
|
||||
public static final String _clientSecret = "clientSecret";
|
||||
private String scope;
|
||||
public static final String _scope = "scope";
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getTransformerId() {
|
||||
return transformerId;
|
||||
}
|
||||
|
||||
public void setTransformerId(String transformerId) {
|
||||
this.transformerId = transformerId;
|
||||
}
|
||||
|
||||
public String getIssuerUrl() {
|
||||
return issuerUrl;
|
||||
}
|
||||
|
||||
public void setIssuerUrl(String issuerUrl) {
|
||||
this.issuerUrl = issuerUrl;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientSecret() {
|
||||
return clientSecret;
|
||||
}
|
||||
|
||||
public void setClientSecret(String clientSecret) {
|
||||
this.clientSecret = clientSecret;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package eu.eudat.model.tenantconfiguration;
|
||||
|
||||
public class CssColorsTenantConfiguration {
|
||||
private String primaryColor;
|
||||
public static final String _primaryColor = "primaryColor";
|
||||
private String primaryColor2;
|
||||
public static final String _primaryColor2 = "primaryColor2";
|
||||
private String primaryColor3;
|
||||
public static final String _primaryColor3 = "primaryColor3";
|
||||
private String secondaryColor;
|
||||
public static final String _secondaryColor = "secondaryColor";
|
||||
|
||||
public String getPrimaryColor() {
|
||||
return primaryColor;
|
||||
}
|
||||
|
||||
public void setPrimaryColor(String primaryColor) {
|
||||
this.primaryColor = primaryColor;
|
||||
}
|
||||
|
||||
public String getPrimaryColor2() {
|
||||
return primaryColor2;
|
||||
}
|
||||
|
||||
public void setPrimaryColor2(String primaryColor2) {
|
||||
this.primaryColor2 = primaryColor2;
|
||||
}
|
||||
|
||||
public String getPrimaryColor3() {
|
||||
return primaryColor3;
|
||||
}
|
||||
|
||||
public void setPrimaryColor3(String primaryColor3) {
|
||||
this.primaryColor3 = primaryColor3;
|
||||
}
|
||||
|
||||
public String getSecondaryColor() {
|
||||
return secondaryColor;
|
||||
}
|
||||
|
||||
public void setSecondaryColor(String secondaryColor) {
|
||||
this.secondaryColor = secondaryColor;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package eu.eudat.model.tenantconfiguration;
|
||||
|
||||
public class DefaultUserLocaleTenantConfiguration {
|
||||
private String timezone;
|
||||
public static final String _timezone = "timezone";
|
||||
private String language;
|
||||
public static final String _language = "language";
|
||||
private String culture;
|
||||
public static final String _culture = "culture";
|
||||
|
||||
public String getTimezone() {
|
||||
return timezone;
|
||||
}
|
||||
|
||||
public void setTimezone(String timezone) {
|
||||
this.timezone = timezone;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public String getCulture() {
|
||||
return culture;
|
||||
}
|
||||
|
||||
public void setCulture(String culture) {
|
||||
this.culture = culture;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package eu.eudat.model.tenantconfiguration;
|
||||
|
||||
import eu.eudat.commons.types.deposit.DepositSourceEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DepositTenantConfiguration {
|
||||
private List<DepositSourceEntity> sources;
|
||||
public static final String _sources = "sources";
|
||||
|
||||
public List<DepositSourceEntity> getSources() {
|
||||
return sources;
|
||||
}
|
||||
|
||||
public void setSources(List<DepositSourceEntity> sources) {
|
||||
this.sources = sources;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.model.tenantconfiguration;
|
||||
|
||||
import eu.eudat.commons.types.filetransformer.FileTransformerSourceEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FileTransformerTenantConfiguration {
|
||||
|
||||
private List<FileTransformerSourceEntity> sources;
|
||||
public static final String _sources = "sources";
|
||||
|
||||
public List<FileTransformerSourceEntity> getSources() {
|
||||
return sources;
|
||||
}
|
||||
|
||||
public void setSources(List<FileTransformerSourceEntity> sources) {
|
||||
this.sources = sources;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package eu.eudat.model.tenantconfiguration;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class LogoTenantConfiguration {
|
||||
private UUID storageFileId;
|
||||
public static final String _storageFileId = "storageFileId";
|
||||
|
||||
public UUID getStorageFileId() {
|
||||
return storageFileId;
|
||||
}
|
||||
|
||||
public void setStorageFileId(UUID storageFileId) {
|
||||
this.storageFileId = storageFileId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
package eu.eudat.model.tenantconfiguration;
|
||||
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
public class TenantConfiguration {
|
||||
|
||||
private UUID id;
|
||||
|
||||
public static final String _id = "id";
|
||||
|
||||
private Instant createdAt;
|
||||
|
||||
public static final String _createdAt = "createdAt";
|
||||
|
||||
private CssColorsTenantConfiguration cssColors;
|
||||
|
||||
public static final String _cssColors = "cssColors";
|
||||
|
||||
private DefaultUserLocaleTenantConfiguration defaultUserLocale;
|
||||
|
||||
public static final String _defaultUserLocale = "defaultUserLocale";
|
||||
|
||||
private DepositTenantConfiguration depositPlugins;
|
||||
|
||||
public static final String _depositPlugins = "depositPlugins";
|
||||
|
||||
private FileTransformerTenantConfiguration fileTransformerPlugins;
|
||||
|
||||
public static final String _fileTransformerPlugins = "fileTransformerPlugins";
|
||||
|
||||
private LogoTenantConfiguration logo;
|
||||
|
||||
public static final String _logo = "logo";
|
||||
|
||||
private Instant updatedAt;
|
||||
|
||||
public static final String _updatedAt = "updatedAt";
|
||||
|
||||
private IsActive isActive;
|
||||
|
||||
public static final String _isActive = "isActive";
|
||||
|
||||
private String hash;
|
||||
|
||||
public static final String _hash = "hash";
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Instant getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public CssColorsTenantConfiguration getCssColors() {
|
||||
return cssColors;
|
||||
}
|
||||
|
||||
public void setCssColors(CssColorsTenantConfiguration cssColors) {
|
||||
this.cssColors = cssColors;
|
||||
}
|
||||
|
||||
public DefaultUserLocaleTenantConfiguration getDefaultUserLocale() {
|
||||
return defaultUserLocale;
|
||||
}
|
||||
|
||||
public void setDefaultUserLocale(DefaultUserLocaleTenantConfiguration defaultUserLocale) {
|
||||
this.defaultUserLocale = defaultUserLocale;
|
||||
}
|
||||
|
||||
public DepositTenantConfiguration getDepositPlugins() {
|
||||
return depositPlugins;
|
||||
}
|
||||
|
||||
public void setDepositPlugins(DepositTenantConfiguration depositPlugins) {
|
||||
this.depositPlugins = depositPlugins;
|
||||
}
|
||||
|
||||
public FileTransformerTenantConfiguration getFileTransformerPlugins() {
|
||||
return fileTransformerPlugins;
|
||||
}
|
||||
|
||||
public void setFileTransformerPlugins(FileTransformerTenantConfiguration fileTransformerPlugins) {
|
||||
this.fileTransformerPlugins = fileTransformerPlugins;
|
||||
}
|
||||
|
||||
public LogoTenantConfiguration getLogo() {
|
||||
return logo;
|
||||
}
|
||||
|
||||
public void setLogo(LogoTenantConfiguration logo) {
|
||||
this.logo = logo;
|
||||
}
|
||||
|
||||
public Instant getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Instant updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public IsActive getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setIsActive(IsActive isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public String getHash() {
|
||||
return hash;
|
||||
}
|
||||
|
||||
public void setHash(String hash) {
|
||||
this.hash = hash;
|
||||
}
|
||||
}
|
|
@ -1,96 +1,20 @@
|
|||
package eu.eudat.service.deposit;
|
||||
|
||||
import eu.eudat.commons.types.deposit.DepositSourceEntity;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ConfigurationProperties(prefix = "deposit")
|
||||
public class DepositProperties {
|
||||
|
||||
private List<DepositSource> sources;
|
||||
private List<DepositSourceEntity> sources;
|
||||
|
||||
public List<DepositSource> getSources() {
|
||||
public List<DepositSourceEntity> getSources() {
|
||||
return sources;
|
||||
}
|
||||
|
||||
public void setSources(List<DepositSource> sources) {
|
||||
public void setSources(List<DepositSourceEntity> sources) {
|
||||
this.sources = sources;
|
||||
}
|
||||
|
||||
public static class DepositSource {
|
||||
|
||||
private String repositoryId;
|
||||
private String url;
|
||||
private String issuerUrl;
|
||||
private String clientId;
|
||||
private String clientSecret;
|
||||
private String scope;
|
||||
private String pdfTransformerId;
|
||||
private String rdaTransformerId;
|
||||
|
||||
public String getRepositoryId() {
|
||||
return repositoryId;
|
||||
}
|
||||
|
||||
public void setRepositoryId(String repositoryId) {
|
||||
this.repositoryId = repositoryId;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getIssuerUrl() {
|
||||
return issuerUrl;
|
||||
}
|
||||
|
||||
public void setIssuerUrl(String issuerUrl) {
|
||||
this.issuerUrl = issuerUrl;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientSecret() {
|
||||
return clientSecret;
|
||||
}
|
||||
|
||||
public void setClientSecret(String clientSecret) {
|
||||
this.clientSecret = clientSecret;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getPdfTransformerId() {
|
||||
return pdfTransformerId;
|
||||
}
|
||||
|
||||
public void setPdfTransformerId(String pdfTransformerId) {
|
||||
this.pdfTransformerId = pdfTransformerId;
|
||||
}
|
||||
|
||||
public String getRdaTransformerId() {
|
||||
return rdaTransformerId;
|
||||
}
|
||||
|
||||
public void setRdaTransformerId(String rdaTransformerId) {
|
||||
this.rdaTransformerId = rdaTransformerId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import eu.eudat.commons.enums.IsActive;
|
|||
import eu.eudat.commons.enums.StorageType;
|
||||
import eu.eudat.commons.notification.NotificationProperties;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
import eu.eudat.commons.types.deposit.DepositSourceEntity;
|
||||
import eu.eudat.commons.types.notification.*;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.data.DmpEntity;
|
||||
|
@ -36,7 +37,7 @@ import eu.eudat.query.UserQuery;
|
|||
import eu.eudat.service.entitydoi.EntityDoiService;
|
||||
import eu.eudat.service.storage.StorageFileProperties;
|
||||
import eu.eudat.service.storage.StorageFileService;
|
||||
import eu.eudat.service.transformer.FileTransformerService;
|
||||
import eu.eudat.service.filetransformer.FileTransformerService;
|
||||
import gr.cite.commons.web.oidc.filter.webflux.TokenExchangeCacheService;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.commons.web.oidc.filter.webflux.TokenExchangeFilterFunction;
|
||||
|
@ -121,7 +122,7 @@ public class DepositServiceImpl implements DepositService {
|
|||
if (this.clients.containsKey(repositoryId)) return this.clients.get(repositoryId);
|
||||
|
||||
//GK: It's register time
|
||||
DepositProperties.DepositSource source = depositProperties.getSources().stream().filter(depositSource -> depositSource.getRepositoryId().equals(repositoryId)).findFirst().orElse(null);
|
||||
DepositSourceEntity source = depositProperties.getSources().stream().filter(depositSource -> depositSource.getRepositoryId().equals(repositoryId)).findFirst().orElse(null);
|
||||
if (source != null) {
|
||||
String host = URI.create(source.getUrl()).getHost();
|
||||
TokenExchangeModel tokenExchangeModel = new TokenExchangeModel("deposit:" + source.getRepositoryId(), source.getIssuerUrl(), source.getClientId(), source.getClientSecret(), source.getScope());
|
||||
|
@ -141,7 +142,7 @@ public class DepositServiceImpl implements DepositService {
|
|||
|
||||
List<eu.eudat.model.deposit.DepositConfiguration> configurations = new ArrayList<>();
|
||||
|
||||
for (DepositProperties.DepositSource depositSource : depositProperties.getSources()) {
|
||||
for (DepositSourceEntity depositSource : depositProperties.getSources()) {
|
||||
DepositConfigurationCacheService.DepositConfigurationCacheValue cacheValue = this.depositConfigurationCacheService.lookup(this.depositConfigurationCacheService.buildKey(depositSource.getRepositoryId()));
|
||||
if (cacheValue == null){
|
||||
DepositClient depositClient = getDepositClient(depositSource.getRepositoryId());
|
||||
|
@ -171,8 +172,8 @@ public class DepositServiceImpl implements DepositService {
|
|||
|
||||
//GK: Forth make the required files to be uploaded with the deposit
|
||||
//TODO: Properly create required files
|
||||
DepositProperties.DepositSource source = depositProperties.getSources().stream().filter(depositSource -> depositSource.getRepositoryId().equals(dmpDepositModel.getRepositoryId())).findFirst().orElse(null);
|
||||
if (source == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDepositModel.getRepositoryId(), DepositProperties.DepositSource.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
DepositSourceEntity source = depositProperties.getSources().stream().filter(depositSource -> depositSource.getRepositoryId().equals(dmpDepositModel.getRepositoryId())).findFirst().orElse(null);
|
||||
if (source == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDepositModel.getRepositoryId(), DepositSourceEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
eu.eudat.model.file.FileEnvelope pdfFile = this.fileTransformerService.exportDmp(dmpEntity.getId(), source.getPdfTransformerId(),"pdf");
|
||||
eu.eudat.model.file.FileEnvelope rda = this.fileTransformerService.exportDmp(dmpEntity.getId(), source.getRdaTransformerId(),"json");
|
||||
|
|
|
@ -7,7 +7,6 @@ import eu.eudat.authorization.authorizationcontentresolver.AuthorizationContentR
|
|||
import eu.eudat.commons.JsonHandlingService;
|
||||
import eu.eudat.commons.XmlHandlingService;
|
||||
import eu.eudat.commons.enums.*;
|
||||
import eu.eudat.commons.enums.notification.NotificationContactType;
|
||||
import eu.eudat.commons.scope.tenant.TenantScope;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
import eu.eudat.commons.types.description.*;
|
||||
|
@ -41,7 +40,7 @@ import eu.eudat.query.*;
|
|||
import eu.eudat.service.elastic.ElasticService;
|
||||
import eu.eudat.service.storage.StorageFileProperties;
|
||||
import eu.eudat.service.storage.StorageFileService;
|
||||
import eu.eudat.service.transformer.FileTransformerService;
|
||||
import eu.eudat.service.filetransformer.FileTransformerService;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.data.builder.BuilderFactory;
|
||||
import gr.cite.tools.data.deleter.DeleterFactory;
|
||||
|
|
|
@ -48,7 +48,7 @@ import eu.eudat.query.*;
|
|||
import eu.eudat.service.actionconfirmation.ActionConfirmationService;
|
||||
import eu.eudat.service.description.DescriptionService;
|
||||
import eu.eudat.service.elastic.ElasticService;
|
||||
import eu.eudat.service.transformer.FileTransformerService;
|
||||
import eu.eudat.service.filetransformer.FileTransformerService;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.data.builder.BuilderFactory;
|
||||
import gr.cite.tools.data.deleter.DeleterFactory;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.service.transformer;
|
||||
package eu.eudat.service.filetransformer;
|
||||
|
||||
import gr.cite.tools.cache.CacheOptions;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.service.transformer;
|
||||
package eu.eudat.service.filetransformer;
|
||||
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.service.transformer;
|
||||
package eu.eudat.service.filetransformer;
|
||||
|
||||
|
||||
import eu.eudat.model.file.TransformerCacheModel;
|
|
@ -0,0 +1,20 @@
|
|||
package eu.eudat.service.filetransformer;
|
||||
|
||||
import eu.eudat.commons.types.filetransformer.FileTransformerSourceEntity;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ConfigurationProperties(prefix = "file-transformer")
|
||||
public class FileTransformerProperties {
|
||||
|
||||
private List<FileTransformerSourceEntity> sources;
|
||||
|
||||
public List<FileTransformerSourceEntity> getSources() {
|
||||
return sources;
|
||||
}
|
||||
|
||||
public void setSources(List<FileTransformerSourceEntity> sources) {
|
||||
this.sources = sources;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.service.transformer;
|
||||
package eu.eudat.service.filetransformer;
|
||||
|
||||
import eu.eudat.commonmodels.models.FileEnvelopeModel;
|
||||
import eu.eudat.commonmodels.models.description.DescriptionModel;
|
|
@ -1,6 +1,5 @@
|
|||
package eu.eudat.service.transformer;
|
||||
package eu.eudat.service.filetransformer;
|
||||
|
||||
import eu.eudat.file.transformer.models.misc.FileFormat;
|
||||
import eu.eudat.model.file.RepositoryFileFormat;
|
||||
|
||||
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.service.transformer;
|
||||
package eu.eudat.service.filetransformer;
|
||||
|
||||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.authorization.Permission;
|
||||
|
@ -6,6 +6,7 @@ import eu.eudat.commonmodels.models.FileEnvelopeModel;
|
|||
import eu.eudat.commonmodels.models.description.DescriptionModel;
|
||||
import eu.eudat.commonmodels.models.dmp.DmpModel;
|
||||
import eu.eudat.commons.enums.StorageType;
|
||||
import eu.eudat.commons.types.filetransformer.FileTransformerSourceEntity;
|
||||
import eu.eudat.file.transformer.interfaces.FileTransformerConfiguration;
|
||||
import eu.eudat.model.Description;
|
||||
import eu.eudat.model.Dmp;
|
||||
|
@ -68,7 +69,7 @@ public class FileTransformerServiceImpl implements FileTransformerService {
|
|||
if (this.clients.containsKey(repoId)) return this.clients.get(repoId);
|
||||
|
||||
//GK: It's register time
|
||||
FileTransformerProperties.TransformerSource source = fileTransformerProperties.getSources().stream().filter(depositSource -> depositSource.getTransformerId().equals(repoId)).findFirst().orElse(null);
|
||||
FileTransformerSourceEntity source = fileTransformerProperties.getSources().stream().filter(depositSource -> depositSource.getTransformerId().equals(repoId)).findFirst().orElse(null);
|
||||
if (source != null) {
|
||||
String host = URI.create(source.getUrl()).getHost();
|
||||
TokenExchangeModel tokenExchangeModel = new TokenExchangeModel(host + "_" + source.getClientId(), source.getIssuerUrl(), source.getClientId(), source.getClientSecret(), source.getScope());
|
|
@ -1,65 +0,0 @@
|
|||
package eu.eudat.service.transformer;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ConfigurationProperties(prefix = "file-transformer")
|
||||
public class FileTransformerProperties {
|
||||
|
||||
private final List<TransformerSource> sources;
|
||||
|
||||
@ConstructorBinding
|
||||
public FileTransformerProperties(List<TransformerSource> sources) {
|
||||
this.sources = sources;
|
||||
}
|
||||
|
||||
public List<TransformerSource> getSources() {
|
||||
return sources;
|
||||
}
|
||||
|
||||
public static class TransformerSource {
|
||||
|
||||
private final String url;
|
||||
private final String transformerId;
|
||||
private final String issuerUrl;
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final String scope;
|
||||
|
||||
@ConstructorBinding
|
||||
public TransformerSource(String url, String transformerId, String issuerUrl, String clientId, String clientSecret, String scope) {
|
||||
this.url = url;
|
||||
this.transformerId = transformerId;
|
||||
this.issuerUrl = issuerUrl;
|
||||
this.clientId = clientId;
|
||||
this.clientSecret = clientSecret;
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getIssuerUrl() {
|
||||
return issuerUrl;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public String getClientSecret() {
|
||||
return clientSecret;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public String getTransformerId() {
|
||||
return transformerId;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ import eu.eudat.audit.AuditableAction;
|
|||
import eu.eudat.model.file.ExportRequestModel;
|
||||
import eu.eudat.model.file.FileEnvelope;
|
||||
import eu.eudat.model.file.RepositoryFileFormat;
|
||||
import eu.eudat.service.transformer.FileTransformerService;
|
||||
import eu.eudat.service.filetransformer.FileTransformerService;
|
||||
import gr.cite.tools.auditing.AuditService;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import gr.cite.tools.logging.MapLogEntry;
|
||||
|
|
|
@ -135,6 +135,26 @@ permissions:
|
|||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
# TenantConfiguration
|
||||
BrowseTenantConfiguration:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditTenantConfiguration:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: true
|
||||
allowAuthenticated: true
|
||||
DeleteTenantConfiguration:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
# Language
|
||||
BrowseLanguage:
|
||||
roles: [ ]
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.063';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
CREATE TABLE public."TenantConfiguration"
|
||||
(
|
||||
id uuid NOT NULL,
|
||||
value character varying NOT NULL,
|
||||
type smallint NOT NULL,
|
||||
is_active smallint NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
tenant uuid,
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (tenant)
|
||||
REFERENCES public."Tenant" (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
NOT VALID
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.063', '2024-04-19 12:00:00.000000+02', now(), 'Add TenantConfiguration Table.');
|
||||
|
||||
END$$;
|
Loading…
Reference in New Issue