multitenant changes
This commit is contained in:
parent
27e6677a21
commit
83b5ec5a80
|
@ -123,9 +123,6 @@ public final class Permission {
|
|||
public static String DeleteUserSettings = "DeleteUserSettings";
|
||||
|
||||
|
||||
// UI Pages
|
||||
public static String ViewDescriptionTemplateTypePage = "ViewDescriptionTemplateTypePage";
|
||||
public static String ViewDmpBlueprintPage = "ViewDmpBlueprintPage";
|
||||
|
||||
//Reference
|
||||
public static String BrowseReference = "BrowseReference";
|
||||
|
@ -191,4 +188,26 @@ public final class Permission {
|
|||
public static String DeletePrefillingSource = "DeletePrefillingSource";
|
||||
|
||||
|
||||
// UI Pages
|
||||
public static String ViewDescriptionTemplateTypePage = "ViewDescriptionTemplateTypePage";
|
||||
public static String ViewMaintenancePage = "ViewMaintenancePage";
|
||||
public static String ViewNotificationPage = "ViewNotificationPage";
|
||||
public static String ViewNotificationTemplatePage = "ViewNotificationTemplatePage";
|
||||
public static String ViewSupportiveMaterialPage = "ViewSupportiveMaterialPage";
|
||||
public static String ViewLanguagePage = "ViewLanguagePage";
|
||||
public static String ViewUserPage = "ViewUserPage";
|
||||
public static String ViewTenantPage = "ViewTenantPage";
|
||||
public static String ViewPrefillingSourcePage = "ViewPrefillingSourcePage";
|
||||
public static String ViewReferenceTypePage = "ViewReferenceTypePage";
|
||||
public static String ViewReferencePage = "ViewReferencePage";
|
||||
public static String ViewEntityLockPage = "ViewEntityLockPage";
|
||||
public static String ViewDescriptionTemplatePage = "ViewDescriptionTemplatePage";
|
||||
public static String ViewDmpBlueprintPage = "ViewDmpBlueprintPage";
|
||||
public static String ViewPublicDescriptionPage = "ViewPublicDescriptionPage";
|
||||
public static String ViewPublicDmpPage = "ViewPublicDmpPage";
|
||||
public static String ViewMyDescriptionPage = "ViewMyDescriptionPage";
|
||||
public static String ViewMyDmpPage = "ViewMyDmpPage";
|
||||
public static String ViewHomePage = "ViewHomePage";
|
||||
public static String ViewMineInAppNotificationPage = "ViewMineInAppNotificationPage";
|
||||
|
||||
}
|
||||
|
|
|
@ -21,9 +21,6 @@ import java.util.UUID;
|
|||
public class TenantEntityManager {
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager;
|
||||
// private final CurrentPrincipalResolver currentPrincipalResolver;
|
||||
// private final ClaimExtractor claimExtractor;
|
||||
// private final AuthorizationService authorizationService;
|
||||
private final TenantScope tenantScope;
|
||||
|
||||
public TenantEntityManager(TenantScope tenantScope) {
|
||||
|
@ -36,23 +33,23 @@ public class TenantEntityManager {
|
|||
}
|
||||
|
||||
public <T> T merge(T entity) throws InvalidApplicationException {
|
||||
if (tenantScope.isMultitenant() && (entity instanceof TenantScoped)) {
|
||||
// this.currentPrincipalResolver.currentPrincipal().isAuthenticated();
|
||||
// this.claimExtractor.subjectUUID(this.currentPrincipalResolver.currentPrincipal());
|
||||
// boolean isAllowedNoTenant = authorizationService.authorize(Permission.AllowNoTenant);
|
||||
|
||||
boolean isAllowedNoTenant = ((TenantScoped) entity).allowNullTenant() || this.tenantScope.isDefaultTenant();
|
||||
final UUID tenantId = !isAllowedNoTenant ? tenantScope.getTenant() : null;
|
||||
if (!isAllowedNoTenant && !tenantId.equals(((TenantScoped) entity).getTenantId())) throw new MyForbiddenException("tenant tampering");
|
||||
if (tenantScope.isMultitenant() && (entity instanceof TenantScoped tenantScopedEntity)) {
|
||||
if (!tenantScope.isDefaultTenant()) {
|
||||
if (tenantScopedEntity.getTenantId() == null || !tenantScopedEntity.getTenantId().equals(tenantScope.getTenant())) throw new MyForbiddenException("tenant tampering");
|
||||
} else if (tenantScopedEntity.getTenantId() != null) {
|
||||
throw new MyForbiddenException("tenant tampering");
|
||||
}
|
||||
}
|
||||
return this.entityManager.merge(entity);
|
||||
}
|
||||
|
||||
public void remove(Object entity) throws InvalidApplicationException {
|
||||
if (tenantScope.isMultitenant() && (entity instanceof TenantScoped)) {
|
||||
boolean isAllowedNoTenant = ((TenantScoped) entity).allowNullTenant() || this.tenantScope.isDefaultTenant();
|
||||
final UUID tenantId = !isAllowedNoTenant ? tenantScope.getTenant() : null;
|
||||
if (!isAllowedNoTenant && !tenantId.equals(((TenantScoped) entity).getTenantId())) throw new MyForbiddenException("tenant tampering");
|
||||
if (tenantScope.isMultitenant() && (entity instanceof TenantScoped tenantScopedEntity)) {
|
||||
if (!tenantScope.isDefaultTenant()) {
|
||||
if (tenantScopedEntity.getTenantId() == null || !tenantScopedEntity.getTenantId().equals(tenantScope.getTenant())) throw new MyForbiddenException("tenant tampering");
|
||||
} else if (tenantScopedEntity.getTenantId() != null) {
|
||||
throw new MyForbiddenException("tenant tampering");
|
||||
}
|
||||
}
|
||||
this.entityManager.remove(entity);
|
||||
}
|
||||
|
@ -60,14 +57,8 @@ public class TenantEntityManager {
|
|||
public <T> T find(Class<T> entityClass, Object primaryKey) throws InvalidApplicationException {
|
||||
T entity = this.entityManager.find(entityClass, primaryKey);
|
||||
|
||||
if (tenantScope.isMultitenant() && (entity instanceof TenantScoped)) {
|
||||
// this.currentPrincipalResolver.currentPrincipal().isAuthenticated();
|
||||
// this.claimExtractor.subjectUUID(this.currentPrincipalResolver.currentPrincipal());
|
||||
// boolean isAllowedNoTenant = authorizationService.authorize(Permission.AllowNoTenant);
|
||||
|
||||
boolean isAllowedNoTenant = ((TenantScoped) entity).allowNullTenant() || this.tenantScope.isDefaultTenant();
|
||||
final UUID tenantId = !isAllowedNoTenant ? tenantScope.getTenant() : null;
|
||||
if (!isAllowedNoTenant && !tenantId.equals(((TenantScoped) entity).getTenantId())) return null;
|
||||
if (tenantScope.isMultitenant() && (entity instanceof TenantScoped tenantScopedEntity)) {
|
||||
if (tenantScopedEntity.getTenantId() != null && !tenantScopedEntity.getTenantId().equals(tenantScope.getTenant())) return null;
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public class TenantListener {
|
|||
logger.error("somebody tried to set not login tenant");
|
||||
throw new MyForbiddenException("tenant tampering");
|
||||
}
|
||||
if (!entity.allowNullTenant() && !tenantScope.isDefaultTenant()) {
|
||||
if (!tenantScope.isDefaultTenant()) {
|
||||
final UUID tenantId = tenantScope.getTenant();
|
||||
entity.setTenantId(tenantId);
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ public class TenantListener {
|
|||
@PreRemove
|
||||
public void setTenantOnUpdate(TenantScoped entity) throws InvalidApplicationException {
|
||||
if (tenantScope.isMultitenant()) {
|
||||
if (!entity.allowNullTenant()){
|
||||
if (!tenantScope.isDefaultTenant()) {
|
||||
if (entity.getTenantId() == null) {
|
||||
logger.error("somebody tried to set null tenant");
|
||||
|
@ -72,12 +71,5 @@ public class TenantListener {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if (entity.getTenantId() != null) {
|
||||
logger.error("somebody tried to set non null tenant");
|
||||
throw new MyForbiddenException("tenant tampering");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,6 @@ public class LanguageServiceImpl implements LanguageService {
|
|||
|
||||
LanguageEntity data;
|
||||
if (isUpdate) {
|
||||
((org.hibernate.Session) entityManager).setHibernateFlushMode(FlushMode.MANUAL);
|
||||
data = this.entityManager.find(LanguageEntity.class, model.getId());
|
||||
if (data == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Language.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
@ -90,11 +89,10 @@ public class LanguageServiceImpl implements LanguageService {
|
|||
data.setPayload(model.getPayload() != null && !model.getPayload().isEmpty() ? model.getPayload() : null);
|
||||
data.setOrdinal(model.getOrdinal());
|
||||
data.setUpdatedAt(Instant.now());
|
||||
data.setIsActive(IsActive.Inactive);
|
||||
// if (isUpdate) this.entityManager.merge(data);
|
||||
// else this.entityManager.persist(data);
|
||||
//
|
||||
// this.entityManager.flush();
|
||||
if (isUpdate) this.entityManager.merge(data);
|
||||
else this.entityManager.persist(data);
|
||||
|
||||
this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(LanguageBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, Language._id), data);
|
||||
}
|
||||
|
|
|
@ -173,11 +173,11 @@ public class UserInterceptor implements WebRequestInterceptor {
|
|||
}
|
||||
}
|
||||
|
||||
List<String> existingUserRoles = this.collectUserRoles(userId);
|
||||
if (!this.userRolesSynced(existingUserRoles)) {
|
||||
this.syncRoles(userId);
|
||||
hasChanges = true;
|
||||
}
|
||||
// List<String> existingUserRoles = this.collectUserRoles(userId);
|
||||
// if (!this.userRolesSynced(existingUserRoles)) {
|
||||
// this.syncRoles(userId);
|
||||
// hasChanges = true;
|
||||
// }
|
||||
|
||||
UserCredentialEntity userCredential = this.queryFactory.query(UserCredentialQuery.class).externalIds(subjectId).first();
|
||||
if (userCredential == null) {
|
||||
|
|
|
@ -15,13 +15,13 @@ permissions:
|
|||
allowAuthenticated: true
|
||||
|
||||
######
|
||||
# public
|
||||
# Affiliation
|
||||
DeferredAffiliation:
|
||||
roles:
|
||||
- Admin
|
||||
- User
|
||||
- Manager
|
||||
- DescriptionTemplateEditor
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
- TenantManager
|
||||
- TenantDescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
|
@ -76,6 +76,11 @@ permissions:
|
|||
clients: [ ]
|
||||
allowAnonymous: true
|
||||
allowAuthenticated: true
|
||||
BrowsePublicStatistics:
|
||||
roles: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: true
|
||||
allowAuthenticated: true
|
||||
# Elastic
|
||||
ManageElastic:
|
||||
roles:
|
||||
|
@ -87,13 +92,13 @@ permissions:
|
|||
# Deposit
|
||||
BrowseDeposit:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditDeposit:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
|
@ -106,13 +111,13 @@ permissions:
|
|||
allowAuthenticated: true
|
||||
EditLanguage:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteLanguage:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -123,15 +128,10 @@ permissions:
|
|||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: true
|
||||
BrowsePublicStatistics:
|
||||
roles: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: true
|
||||
allowAuthenticated: true
|
||||
# Description
|
||||
BrowseDescription:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -143,7 +143,7 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
EditDescription:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -153,7 +153,7 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
FinalizeDescription:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -163,7 +163,7 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
DeleteDescription:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -174,7 +174,7 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
CloneDescription:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -186,19 +186,19 @@ permissions:
|
|||
# Tag
|
||||
BrowseTag:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditTag:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteTag:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -206,33 +206,33 @@ permissions:
|
|||
# User
|
||||
BrowseUser:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditUser:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteUser:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ExportUsers:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
BrowseDmpAssociatedUser:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -246,22 +246,22 @@ permissions:
|
|||
# DescriptionTemplateType
|
||||
BrowseDescriptionTemplateType:
|
||||
roles:
|
||||
- Admin
|
||||
- User
|
||||
- Manager
|
||||
- DescriptionTemplateEditor
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
- TenantManager
|
||||
- TenantDescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditDescriptionTemplateType:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteDescriptionTemplateType:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -275,14 +275,14 @@ permissions:
|
|||
allowAuthenticated: true
|
||||
EditStorageFile:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteStorageFile:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -290,56 +290,56 @@ permissions:
|
|||
# DescriptionTemplate
|
||||
BrowseDescriptionTemplate:
|
||||
roles:
|
||||
- Admin
|
||||
- DescriptionTemplateEditor
|
||||
- Manager
|
||||
- User
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
- TenantManager
|
||||
- TenantDescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditDescriptionTemplate:
|
||||
roles:
|
||||
- Admin
|
||||
- DescriptionTemplateEditor
|
||||
- TenantAdmin
|
||||
- TenantDescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteDescriptionTemplate:
|
||||
roles:
|
||||
- Admin
|
||||
- DescriptionTemplateEditor
|
||||
- TenantAdmin
|
||||
- TenantDescriptionTemplateEditor
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
CloneDescriptionTemplate:
|
||||
roles:
|
||||
- Admin
|
||||
- DescriptionTemplateEditor
|
||||
- TenantAdmin
|
||||
- TenantDescriptionTemplateEditor
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
CreateNewVersionDescriptionTemplate:
|
||||
roles:
|
||||
- Admin
|
||||
- DescriptionTemplateEditor
|
||||
- TenantAdmin
|
||||
- TenantDescriptionTemplateEditor
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ImportDescriptionTemplate:
|
||||
roles:
|
||||
- Admin
|
||||
- DescriptionTemplateEditor
|
||||
- TenantAdmin
|
||||
- TenantDescriptionTemplateEditor
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ExportDescriptionTemplate:
|
||||
roles:
|
||||
- Admin
|
||||
- DescriptionTemplateEditor
|
||||
- TenantAdmin
|
||||
- TenantDescriptionTemplateEditor
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -347,13 +347,13 @@ permissions:
|
|||
# Dmp
|
||||
BrowseDmp:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditDmp:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -365,16 +365,16 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
NewDmp:
|
||||
roles:
|
||||
- Admin
|
||||
- User
|
||||
- Manager
|
||||
- DescriptionTemplateEditor
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
- TenantManager
|
||||
- TenantDescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteDmp:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -384,7 +384,7 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
DepositDmp:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -394,7 +394,7 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
CloneDmp:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -404,7 +404,7 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
ExportDmp:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -414,7 +414,7 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
CreateNewVersionDmp:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -424,7 +424,7 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
FinalizeDmp:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -434,7 +434,7 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
UndoFinalizeDmp:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -444,7 +444,7 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
AssignDmpUsers:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -454,7 +454,7 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
InviteDmpUsers:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -465,47 +465,47 @@ permissions:
|
|||
# DmpBlueprint
|
||||
BrowseDmpBlueprint:
|
||||
roles:
|
||||
- Admin
|
||||
- User
|
||||
- Manager
|
||||
- DescriptionTemplateEditor
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
- TenantManager
|
||||
- TenantDescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditDmpBlueprint:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
CloneDmpBlueprint:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
CreateNewVersionDmpBlueprint:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ExportDmpBlueprint:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ImportDmpBlueprint:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteDmpBlueprint:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -513,48 +513,41 @@ permissions:
|
|||
# EntityDoi
|
||||
BrowseEntityDoi:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditEntityDoi:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteEntityDoi:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
|
||||
# ViewPage Permissions
|
||||
ViewDescriptionTemplateTypePage:
|
||||
roles:
|
||||
- Admin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
|
||||
# Reference Permissions
|
||||
BrowseReference:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditReference:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteReference:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -563,19 +556,19 @@ permissions:
|
|||
# DmpReference Permissions
|
||||
BrowseDmpReference:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditDmpReference:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteDmpReference:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -584,19 +577,19 @@ permissions:
|
|||
# DmpUser Permissions
|
||||
BrowseDmpUser:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditDmpUser:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteDmpUser:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -607,20 +600,22 @@ permissions:
|
|||
roles:
|
||||
- Admin
|
||||
- User
|
||||
- Manager
|
||||
- DescriptionTemplateEditor
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
- TenantManager
|
||||
- TenantDescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: yes
|
||||
allowAuthenticated: yes
|
||||
EditSupportiveMaterial:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteSupportiveMaterial:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -629,22 +624,22 @@ permissions:
|
|||
# ReferenceType Permissions
|
||||
BrowseReferenceType:
|
||||
roles:
|
||||
- Admin
|
||||
- User
|
||||
- Manager
|
||||
- DescriptionTemplateEditor
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
- TenantManager
|
||||
- TenantDescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditReferenceType:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteReferenceType:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -670,30 +665,26 @@ permissions:
|
|||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
AllowNoTenant:
|
||||
roles:
|
||||
- TenantManager
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
|
||||
# TenantUser Permissions
|
||||
BrowseTenantUser:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditTenantUser:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteTenantUser:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -702,19 +693,19 @@ permissions:
|
|||
# DmpDescriptionTemplate Permissions
|
||||
BrowseDmpDescriptionTemplate:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditDmpDescriptionTemplate:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteDmpDescriptionTemplate:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -723,19 +714,19 @@ permissions:
|
|||
# DescriptionReference Permissions
|
||||
BrowseDescriptionReference:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditDescriptionReference:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteDescriptionReference:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -744,19 +735,19 @@ permissions:
|
|||
# DescriptionReference Permissions
|
||||
BrowseDescriptionTag:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditDescriptionTag:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteDescriptionTag:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -764,10 +755,10 @@ permissions:
|
|||
# Prefilling
|
||||
BrowsePrefilling:
|
||||
roles:
|
||||
- Admin
|
||||
- DescriptionTemplateEditor
|
||||
- Manager
|
||||
- User
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
- TenantManager
|
||||
- TenantDescriptionTemplateEditor
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -776,16 +767,16 @@ permissions:
|
|||
# Lock Permissions
|
||||
BrowseLock:
|
||||
roles:
|
||||
- Admin
|
||||
- DescriptionTemplateEditor
|
||||
- Manager
|
||||
- User
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
- TenantManager
|
||||
- TenantDescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditLock:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -797,7 +788,7 @@ permissions:
|
|||
allowAuthenticated: false
|
||||
DeleteLock:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
dmp:
|
||||
roles:
|
||||
- Owner
|
||||
|
@ -808,6 +799,7 @@ permissions:
|
|||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
|
||||
# Contact Permissions
|
||||
SendContactSupport:
|
||||
roles: []
|
||||
|
@ -817,19 +809,19 @@ permissions:
|
|||
# ActionConfirmation Permissions
|
||||
BrowseActionConfirmation:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditActionConfirmation:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteActionConfirmation:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
|
@ -838,23 +830,148 @@ permissions:
|
|||
# PrefillingSource Permissions
|
||||
BrowsePrefillingSource:
|
||||
roles:
|
||||
- Admin
|
||||
- DescriptionTemplateEditor
|
||||
- Manager
|
||||
- User
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
- TenantManager
|
||||
- TenantDescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditPrefillingSource:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeletePrefillingSource:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
claims: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
|
||||
# ViewPage Permissions
|
||||
ViewDescriptionTemplateTypePage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewMaintenancePage:
|
||||
roles:
|
||||
- Admin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewNotificationPage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewNotificationTemplatePage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewSupportiveMaterialPage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewLanguagePage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewUserPage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewTenantPage:
|
||||
roles:
|
||||
- Admin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewPrefillingSourcePage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewReferenceTypePage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewReferencePage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewEntityLockPage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewDescriptionTemplatePage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
- TenantDescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewDmpBlueprintPage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewPublicDescriptionPage:
|
||||
roles: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: true
|
||||
allowAuthenticated: true
|
||||
ViewPublicDmpPage:
|
||||
roles: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: true
|
||||
allowAuthenticated: true
|
||||
ViewMyDescriptionPage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
- TenantManager
|
||||
- TenantDescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewMyDmpPage:
|
||||
roles:
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
- TenantManager
|
||||
- TenantDescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ViewHomePage:
|
||||
roles: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: true
|
||||
allowAuthenticated: true
|
||||
ViewMineInAppNotificationPage:
|
||||
roles: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: true
|
|
@ -30,6 +30,9 @@ const appRoutes: Routes = [
|
|||
path: 'descriptions',
|
||||
loadChildren: () => import('./ui/description/description.module').then(m => m.DescriptionModule),
|
||||
data: {
|
||||
authContext: {
|
||||
permissions: [AppPermission.ViewMyDescriptionPage]
|
||||
},
|
||||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.DESCRIPTIONS'
|
||||
}
|
||||
|
@ -46,6 +49,9 @@ const appRoutes: Routes = [
|
|||
path: 'plans',
|
||||
loadChildren: () => import('./ui/dmp/dmp.module').then(m => m.DmpModule),
|
||||
data: {
|
||||
authContext: {
|
||||
permissions: [AppPermission.ViewMyDmpPage]
|
||||
},
|
||||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.PLANS'
|
||||
}
|
||||
|
@ -188,6 +194,9 @@ const appRoutes: Routes = [
|
|||
path: 'users',
|
||||
loadChildren: () => import('./ui/admin/user/user.module').then(m => m.UsersModule),
|
||||
data: {
|
||||
authContext: {
|
||||
permissions: [AppPermission.ViewUserPage]
|
||||
},
|
||||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.USERS'
|
||||
},
|
||||
|
@ -324,6 +333,9 @@ const appRoutes: Routes = [
|
|||
path: 'index-managment',
|
||||
loadChildren: () => import('./ui/admin/index-managment/index-managment.module').then(m => m.IndexManagmentModule),
|
||||
data: {
|
||||
authContext: {
|
||||
permissions: [AppPermission.ViewMaintenancePage]
|
||||
},
|
||||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.INDEX-MANAGMENT'
|
||||
},
|
||||
|
@ -332,6 +344,9 @@ const appRoutes: Routes = [
|
|||
path: 'maintenance-tasks',
|
||||
loadChildren: () => import('./ui/admin/maintenance-tasks/maintenance-tasks.module').then(m => m.MaintenanceTasksModule),
|
||||
data: {
|
||||
authContext: {
|
||||
permissions: [AppPermission.ViewMaintenancePage]
|
||||
},
|
||||
breadcrumb: true
|
||||
},
|
||||
},
|
||||
|
|
|
@ -33,20 +33,6 @@ export enum AppPermission {
|
|||
EditDescriptionTemplate = "EditDescriptionTemplate",
|
||||
DeleteDescriptionTemplate = "DeleteDescriptionTemplate",
|
||||
|
||||
// UI Pages
|
||||
ViewDescriptionTemplateTypePage = "ViewDescriptionTemplateTypePage",
|
||||
ViewDmpBlueprintPage = "ViewDmpBlueprintPage",
|
||||
ViewDescriptionTemplatePage = "ViewDescriptionTemplatePage",
|
||||
ViewSupportiveMaterialPage = 'ViewSupportiveMaterialPage',
|
||||
ViewReferenceTypePage = 'ViewReferenceTypePage',
|
||||
ViewReferencePage = 'ViewReferencePage',
|
||||
ViewTenantPage = 'ViewTenantPage',
|
||||
ViewLanguagePage = "ViewLanguagePage",
|
||||
ViewNotificationTemplatePage = "ViewNotificationTemplatePage",
|
||||
ViewMineInAppNotificationPage = "ViewMineInAppNotificationPage",
|
||||
ViewNotificationPage = "ViewNotificationPage",
|
||||
ViewPrefillingSourcePage = "ViewPrefillingSourcePage",
|
||||
ViewEntityLockPage = "ViewEntityLockPage",
|
||||
|
||||
//ReferenceType
|
||||
BrowseReferenceType = "BrowseReferenceType",
|
||||
|
@ -83,5 +69,27 @@ export enum AppPermission {
|
|||
BrowsePrefillingSource= "BrowsePrefillingSource",
|
||||
EditPrefillingSource = "EditPrefillingSource",
|
||||
DeletePrefillingSource = "DeletePrefillingSource",
|
||||
|
||||
// UI Pages
|
||||
ViewDescriptionTemplateTypePage = "ViewDescriptionTemplateTypePage",
|
||||
ViewMaintenancePage = "ViewMaintenancePage",
|
||||
ViewNotificationPage = "ViewNotificationPage",
|
||||
ViewNotificationTemplatePage = "ViewNotificationTemplatePage",
|
||||
ViewSupportiveMaterialPage = "ViewSupportiveMaterialPage",
|
||||
ViewLanguagePage = "ViewLanguagePage",
|
||||
ViewUserPage = "ViewUserPage",
|
||||
ViewTenantPage = "ViewTenantPage",
|
||||
ViewPrefillingSourcePage = "ViewPrefillingSourcePage",
|
||||
ViewReferenceTypePage = "ViewReferenceTypePage",
|
||||
ViewReferencePage = "ViewReferencePage",
|
||||
ViewEntityLockPage = "ViewEntityLockPage",
|
||||
ViewDescriptionTemplatePage = "ViewDescriptionTemplatePage",
|
||||
ViewDmpBlueprintPage = "ViewDmpBlueprintPage",
|
||||
ViewPublicDescriptionPage = "ViewPublicDescriptionPage",
|
||||
ViewPublicDmpPage = "ViewPublicDmpPage",
|
||||
ViewMyDescriptionPage = "ViewMyDescriptionPage",
|
||||
ViewMyDmpPage = "ViewMyDmpPage",
|
||||
ViewHomePage = "ViewHomePage",
|
||||
ViewMineInAppNotificationPage = "ViewMineInAppNotificationPage",
|
||||
}
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ export class AuthService extends BaseService {
|
|||
}
|
||||
private evaluatePermission(availablePermissions: string[], permissionToCheck: string): boolean {
|
||||
if (!permissionToCheck) { return false; }
|
||||
if (this.hasRole(AppRole.Admin)) { return true; }
|
||||
// if (this.hasRole(AppRole.Admin)) { return true; }
|
||||
return availablePermissions.map(x => x.toLowerCase()).includes(permissionToCheck.toLowerCase());
|
||||
}
|
||||
public hasAnyPermission(permissions: AppPermission[]): boolean {
|
||||
|
|
|
@ -188,7 +188,7 @@ export class TenantDepositConfigEditorModel implements TenantDepositConfigPersis
|
|||
|
||||
const baseContext: ValidationContext = new ValidationContext();
|
||||
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||
baseValidationArray.push({ key: 'sources', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}sources`)] });
|
||||
baseValidationArray.push({ key: 'sources', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}sources`)] });
|
||||
|
||||
baseContext.validation = baseValidationArray;
|
||||
return baseContext;
|
||||
|
@ -258,7 +258,7 @@ export class TenantFileTransformersConfigEditorModel implements TenantFileTransf
|
|||
|
||||
const baseContext: ValidationContext = new ValidationContext();
|
||||
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||
baseValidationArray.push({ key: 'sources', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}sources`)] });
|
||||
baseValidationArray.push({ key: 'sources', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}sources`)] });
|
||||
|
||||
baseContext.validation = baseValidationArray;
|
||||
return baseContext;
|
||||
|
|
|
@ -15,7 +15,6 @@ import { takeUntil } from 'rxjs/operators';
|
|||
import { StartNewDmpDialogComponent } from '../dmp/new/start-new-dmp-dialogue/start-new-dmp-dialog.component';
|
||||
import { FaqDialogComponent } from '../faq/dialog/faq-dialog.component';
|
||||
import { UserDialogComponent } from './user-dialog/user-dialog.component';
|
||||
import { DATASETS_ROUTES, DMP_ROUTES, GENERAL_ROUTES } from '../sidebar/sidebar.component';
|
||||
import { MineInAppNotificationListingDialogComponent } from '../inapp-notification/listing-dialog/mine-inapp-notification-listing-dialog.component';
|
||||
import { InAppNotificationService } from '@app/core/services/inapp-notification/inapp-notification.service';
|
||||
import { timer } from 'rxjs';
|
||||
|
@ -28,7 +27,7 @@ import { ConfigurationService } from '@app/core/services/configuration/configura
|
|||
})
|
||||
export class NavbarComponent extends BaseComponent implements OnInit {
|
||||
progressIndication = false;
|
||||
private listTitles: any[];
|
||||
//private listTitles: any[];
|
||||
location: Location;
|
||||
mobile_menu_visible: any = 0;
|
||||
private toggleButton: any;
|
||||
|
@ -64,10 +63,10 @@ export class NavbarComponent extends BaseComponent implements OnInit {
|
|||
ngOnInit() {
|
||||
this.matomoService.trackPageView('Navbar');
|
||||
this.currentRoute = this.router.url;
|
||||
this.listTitles = GENERAL_ROUTES.filter(listTitle => listTitle);
|
||||
this.listTitles.push(DMP_ROUTES.filter(listTitle => listTitle));
|
||||
// this.listTitles = GENERAL_ROUTES.filter(listTitle => listTitle);
|
||||
// this.listTitles.push(DMP_ROUTES.filter(listTitle => listTitle));
|
||||
// this.listTitles.push(HISTORY_ROUTES.filter(listTitle => listTitle));
|
||||
this.listTitles.push(DATASETS_ROUTES.filter(listTitle => listTitle));
|
||||
// this.listTitles.push(DATASETS_ROUTES.filter(listTitle => listTitle));
|
||||
// const navbar: HTMLElement = this.element.nativeElement;
|
||||
// this.toggleButton = navbar.getElementsByClassName('navbar-toggler')[0];
|
||||
// this.router.events.subscribe((event) => {
|
||||
|
@ -193,20 +192,20 @@ export class NavbarComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
};
|
||||
|
||||
getTitle() {
|
||||
var titlee = this.location.prepareExternalUrl(this.location.path());
|
||||
if (titlee.charAt(0) === '#') {
|
||||
titlee = titlee.slice(2);
|
||||
}
|
||||
titlee = titlee.split('/').pop();
|
||||
// getTitle() {
|
||||
// var titlee = this.location.prepareExternalUrl(this.location.path());
|
||||
// if (titlee.charAt(0) === '#') {
|
||||
// titlee = titlee.slice(2);
|
||||
// }
|
||||
// titlee = titlee.split('/').pop();
|
||||
|
||||
for (var item = 0; item < this.listTitles.length; item++) {
|
||||
if (this.listTitles[item].path === titlee) {
|
||||
return this.listTitles[item].title;
|
||||
}
|
||||
}
|
||||
return 'Dashboard';
|
||||
}
|
||||
// for (var item = 0; item < this.listTitles.length; item++) {
|
||||
// if (this.listTitles[item].path === titlee) {
|
||||
// return this.listTitles[item].title;
|
||||
// }
|
||||
// }
|
||||
// return 'Dashboard';
|
||||
// }
|
||||
|
||||
public getCurrentLanguage(): any {
|
||||
const lang = this.languages.find(lang => lang.value === this.languageService.getCurrentLanguage());
|
||||
|
|
|
@ -6,9 +6,11 @@ import { Router } from '@angular/router';
|
|||
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { AppRole } from '../../core/common/enum/app-role';
|
||||
import { AuthService } from '../../core/services/auth/auth.service';
|
||||
import { AuthService, LoginStatus } from '../../core/services/auth/auth.service';
|
||||
import { LanguageDialogComponent } from '../language/dialog/language-dialog.component';
|
||||
import { UserDialogComponent } from '../navbar/user-dialog/user-dialog.component';
|
||||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
declare interface RouteInfo {
|
||||
path: string;
|
||||
|
@ -19,56 +21,8 @@ declare interface RouteInfo {
|
|||
declare interface GroupMenuItem {
|
||||
title: string;
|
||||
routes: RouteInfo[];
|
||||
requiresAuthentication: boolean;
|
||||
requiresSpecialPermission?: AppRole;
|
||||
requiresAdmin: boolean;
|
||||
isGeneral: boolean;
|
||||
}
|
||||
|
||||
export const GENERAL_ROUTES: RouteInfo[] = [
|
||||
{ path: '/home', title: 'SIDE-BAR.DASHBOARD', icon: 'home' }
|
||||
];
|
||||
export const DMP_ROUTES: RouteInfo[] = [
|
||||
{ path: '/plans', title: 'SIDE-BAR.MY-DMPS', icon: 'library_books' },
|
||||
{ path: '/descriptions', title: 'SIDE-BAR.MY-DESCRIPTIONS', icon: 'dns' },
|
||||
];
|
||||
export const DATASETS_ROUTES: RouteInfo[] = [
|
||||
{ path: '/explore-plans', title: 'SIDE-BAR.PUBLIC-DMPS', icon: 'library_books' },
|
||||
{ path: '/explore-descriptions', title: 'SIDE-BAR.PUBLIC-DESC', icon: 'dns' },
|
||||
];
|
||||
|
||||
export const PUBLIC_ROUTES: RouteInfo[] = [
|
||||
{ path: '/explore-plans', title: 'SIDE-BAR.PUBLIC-DMPS', icon: 'library_books' },
|
||||
{ path: '/explore-descriptions', title: 'SIDE-BAR.PUBLIC-DESC', icon: 'dns' }
|
||||
];
|
||||
|
||||
export const ADMIN_ROUTES: RouteInfo[] = [
|
||||
{ path: '/dmp-blueprints', title: 'SIDE-BAR.DMP-BLUEPRINTS', icon: 'library_books' },
|
||||
{ path: '/description-templates', title: 'SIDE-BAR.DESCRIPTION-TEMPLATES', icon: 'description' },
|
||||
{ path: '/description-template-type', title: 'SIDE-BAR.DESCRIPTION-TEMPLATE-TYPES', icon: 'stack' },
|
||||
{ path: '/entity-locks', title: 'SIDE-BAR.ENTITY-LOCKS', icon: 'build' },
|
||||
{ path: '/references', title: 'SIDE-BAR.REFERENCES', icon: 'dataset_linked' },
|
||||
{ path: '/reference-type', title: 'SIDE-BAR.REFERENCE-TYPES', icon: 'add_link' },
|
||||
{ path: '/prefilling-sources', title: 'SIDE-BAR.PREFILLING-SOURCES', icon: 'add_link' },
|
||||
{ path: '/tenants', title: 'SIDE-BAR.TENANTS', icon: 'tenancy' },
|
||||
{ path: '/users', title: 'SIDE-BAR.USERS', icon: 'people' },
|
||||
{ path: '/languages', title: 'SIDE-BAR.LANGUAGES', icon: 'language' },
|
||||
{ path: '/supportive-material', title: 'SIDE-BAR.SUPPORTIVE-MATERIAL', icon: 'dataset_linked' },
|
||||
{ path: '/notification-templates', title: 'SIDE-BAR.NOTIFICATION-TEMPLATES', icon: 'build' },
|
||||
{ path: '/notifications', title: 'SIDE-BAR.NOTIFICATIONS', icon: 'build' },
|
||||
{ path: '/index-managment', title: 'SIDE-BAR.MAINTENANCE', icon: 'build' }
|
||||
];
|
||||
|
||||
export const DATASET_TEMPLATE_ROUTES: RouteInfo[] = [
|
||||
{ path: '/description-templates', title: 'SIDE-BAR.DESCRIPTION-TEMPLATES', icon: 'description' }
|
||||
];
|
||||
|
||||
export const INFO_ROUTES: RouteInfo[] = [
|
||||
{ path: '/co-branding', title: 'SIDE-BAR.CO-BRANDING', icon: 'toll' },
|
||||
{ path: '/contact-support', title: 'SIDE-BAR.SUPPORT', icon: 'help' },
|
||||
{ path: '/feedback', title: 'SIDE-BAR.FEEDBACK', icon: 'feedback', url: 'https://docs.google.com/forms/d/12RSCrUjdSDp2LZLpjDKOi44cN1fLDD2q1-F66SqZIis/viewform?edit_requested=true' }
|
||||
];
|
||||
|
||||
@Component({
|
||||
selector: 'app-sidebar',
|
||||
templateUrl: './sidebar.component.html',
|
||||
|
@ -102,71 +56,80 @@ export class SidebarComponent implements OnInit {
|
|||
ngOnInit() {
|
||||
this.matomoService.trackPageView('Sidebar');
|
||||
this.currentRoute = this.router.url;
|
||||
|
||||
this.authentication.getAuthenticationStateObservable().pipe().subscribe(authenticationState => {
|
||||
this.reCalculateMenu()
|
||||
});
|
||||
|
||||
this.reCalculateMenu();
|
||||
|
||||
this.router.events.subscribe((event) => this.currentRoute = this.router.url);
|
||||
}
|
||||
|
||||
private reCalculateMenu() {
|
||||
this.groupMenuItems = []
|
||||
this.generalItems = {
|
||||
title: 'SIDE-BAR.GENERAL',
|
||||
routes: GENERAL_ROUTES,
|
||||
requiresAuthentication: false,
|
||||
requiresAdmin: false,
|
||||
isGeneral: true
|
||||
routes: [],
|
||||
}
|
||||
this.generalItems.routes.push({ path: '/home', title: 'SIDE-BAR.DASHBOARD', icon: 'home' });
|
||||
|
||||
this.groupMenuItems.push(this.generalItems);
|
||||
|
||||
this.dmpItems = {
|
||||
title: 'SIDE-BAR.DMP',
|
||||
routes: DMP_ROUTES,
|
||||
requiresAuthentication: true,
|
||||
requiresAdmin: false,
|
||||
isGeneral: false
|
||||
routes: [],
|
||||
}
|
||||
|
||||
if (this.authentication.hasPermission(AppPermission.ViewMyDmpPage)) this.dmpItems.routes.push({ path: '/plans', title: 'SIDE-BAR.MY-DMPS', icon: 'library_books' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewMyDescriptionPage)) this.dmpItems.routes.push({ path: '/descriptions', title: 'SIDE-BAR.MY-DESCRIPTIONS', icon: 'dns' });
|
||||
this.groupMenuItems.push(this.dmpItems);
|
||||
|
||||
this.datasetItems = {
|
||||
title: 'SIDE-BAR.DATASETS',
|
||||
routes: DATASETS_ROUTES,
|
||||
requiresAuthentication: true,
|
||||
requiresAdmin: false,
|
||||
isGeneral: false
|
||||
routes: [],
|
||||
}
|
||||
|
||||
if (this.authentication.hasPermission(AppPermission.ViewPublicDmpPage)) this.datasetItems.routes.push({ path: '/explore-plans', title: 'SIDE-BAR.PUBLIC-DMPS', icon: 'library_books' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewPublicDescriptionPage)) this.datasetItems.routes.push({ path: '/explore-descriptions', title: 'SIDE-BAR.PUBLIC-DESC', icon: 'dns' });
|
||||
this.groupMenuItems.push(this.datasetItems);
|
||||
|
||||
this.adminItems = {
|
||||
title: 'SIDE-BAR.ADMIN',
|
||||
routes: ADMIN_ROUTES,
|
||||
requiresAuthentication: true,
|
||||
requiresAdmin: true,
|
||||
isGeneral: false
|
||||
}
|
||||
this.groupMenuItems.push(this.adminItems);
|
||||
|
||||
this.datasetTemplateItems = {
|
||||
title: 'SIDE-BAR.ADMIN',
|
||||
routes: DATASET_TEMPLATE_ROUTES,
|
||||
requiresAuthentication: true,
|
||||
requiresSpecialPermission: AppRole.DescriptionTemplateEditor,
|
||||
requiresAdmin: false,
|
||||
isGeneral: false
|
||||
}
|
||||
this.groupMenuItems.push(this.datasetTemplateItems);
|
||||
|
||||
this.publicItems = {
|
||||
title: 'SIDE-BAR.PUBLIC',
|
||||
routes: PUBLIC_ROUTES,
|
||||
requiresAuthentication: false,
|
||||
requiresAdmin: false,
|
||||
isGeneral: false
|
||||
routes: [],
|
||||
}
|
||||
this.publicItems.routes.push({ path: '/explore-plans', title: 'SIDE-BAR.PUBLIC-DMPS', icon: 'library_books' });
|
||||
this.publicItems.routes.push({ path: '/explore-descriptions', title: 'SIDE-BAR.PUBLIC-DESC', icon: 'dns' });
|
||||
this.groupMenuItems.push(this.publicItems);
|
||||
|
||||
this.adminItems = {
|
||||
title: 'SIDE-BAR.ADMIN',
|
||||
routes: [],
|
||||
}
|
||||
if (this.authentication.hasPermission(AppPermission.ViewDmpBlueprintPage)) this.adminItems.routes.push({ path: '/dmp-blueprints', title: 'SIDE-BAR.DMP-BLUEPRINTS', icon: 'library_books' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewDescriptionTemplatePage)) this.adminItems.routes.push({ path: '/description-templates', title: 'SIDE-BAR.DESCRIPTION-TEMPLATES', icon: 'description' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewDescriptionTemplateTypePage)) this.adminItems.routes.push({ path: '/description-template-type', title: 'SIDE-BAR.DESCRIPTION-TEMPLATE-TYPES', icon: 'stack' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewEntityLockPage)) this.adminItems.routes.push({ path: '/entity-locks', title: 'SIDE-BAR.ENTITY-LOCKS', icon: 'build' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewReferencePage)) this.adminItems.routes.push({ path: '/references', title: 'SIDE-BAR.REFERENCES', icon: 'dataset_linked' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewReferenceTypePage)) this.adminItems.routes.push({ path: '/reference-type', title: 'SIDE-BAR.REFERENCE-TYPES', icon: 'add_link' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewPrefillingSourcePage)) this.adminItems.routes.push({ path: '/prefilling-sources', title: 'SIDE-BAR.PREFILLING-SOURCES', icon: 'add_link' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewTenantPage)) this.adminItems.routes.push({ path: '/tenants', title: 'SIDE-BAR.TENANTS', icon: 'tenancy' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewUserPage)) this.adminItems.routes.push({ path: '/users', title: 'SIDE-BAR.USERS', icon: 'people' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewLanguagePage)) this.adminItems.routes.push({ path: '/languages', title: 'SIDE-BAR.LANGUAGES', icon: 'language' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewSupportiveMaterialPage)) this.adminItems.routes.push({ path: '/supportive-material', title: 'SIDE-BAR.SUPPORTIVE-MATERIAL', icon: 'dataset_linked' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewNotificationTemplatePage)) this.adminItems.routes.push({ path: '/notification-templates', title: 'SIDE-BAR.NOTIFICATION-TEMPLATES', icon: 'build' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewNotificationPage)) this.adminItems.routes.push({ path: '/notifications', title: 'SIDE-BAR.NOTIFICATIONS', icon: 'build' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewMaintenancePage)) this.adminItems.routes.push({ path: '/index-managment', title: 'SIDE-BAR.MAINTENANCE', icon: 'build' });
|
||||
this.groupMenuItems.push(this.adminItems);
|
||||
|
||||
this.infoItems = {
|
||||
title: "",
|
||||
routes: INFO_ROUTES,
|
||||
requiresAuthentication: false,
|
||||
requiresAdmin: false,
|
||||
isGeneral: false
|
||||
routes: [],
|
||||
}
|
||||
this.infoItems.routes.push({ path: '/co-branding', title: 'SIDE-BAR.CO-BRANDING', icon: 'toll' });
|
||||
this.infoItems.routes.push({ path: '/contact-support', title: 'SIDE-BAR.SUPPORT', icon: 'help' });
|
||||
this.infoItems.routes.push({ path: '/feedback', title: 'SIDE-BAR.FEEDBACK', icon: 'feedback', url: 'https://docs.google.com/forms/d/12RSCrUjdSDp2LZLpjDKOi44cN1fLDD2q1-F66SqZIis/viewform?edit_requested=true' });
|
||||
this.groupMenuItems.push(this.infoItems);
|
||||
|
||||
this.router.events.subscribe((event) => this.currentRoute = this.router.url);
|
||||
}
|
||||
|
||||
public principalHasAvatar(): boolean {
|
||||
|
@ -206,20 +169,7 @@ export class SidebarComponent implements OnInit {
|
|||
}
|
||||
|
||||
showItem(value: GroupMenuItem) {
|
||||
if (this.isAuthenticated()) {
|
||||
if (value.requiresAdmin) {
|
||||
return this.isAdmin();
|
||||
}
|
||||
else if (value.requiresSpecialPermission !== undefined) {
|
||||
return this.hasPermission(value.requiresSpecialPermission);
|
||||
}
|
||||
else {
|
||||
return value.isGeneral || value.requiresAuthentication;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return !value.requiresAuthentication;
|
||||
}
|
||||
return value.routes && value.routes.length > 0;
|
||||
}
|
||||
|
||||
openProfile() {
|
||||
|
|
Loading…
Reference in New Issue