Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Sofia Papacharalampous 2024-06-03 15:52:36 +03:00
commit 601b748388
31 changed files with 493 additions and 256 deletions

View File

@ -4,27 +4,24 @@ permissions:
roles: roles:
- TenantAdmin - TenantAdmin
- TenantUser - TenantUser
- TenantManager - TenantPlanManager
- TenantDescriptionTemplateEditor - TenantConfigManager
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
# Tenants # Tenants
BrowseTenant: BrowseTenant:
roles: roles: [ ]
- Admin
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
EditTenant: EditTenant:
roles: roles: [ ]
- Admin
clients: [ "opencdmp-api-dev" ] clients: [ "opencdmp-api-dev" ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
DeleteTenant: DeleteTenant:
roles: roles: [ ]
- Admin
claims: [ ] claims: [ ]
clients: [ "opencdmp-api-dev" ] clients: [ "opencdmp-api-dev" ]
allowAnonymous: false allowAnonymous: false
@ -32,6 +29,7 @@ permissions:
AllowNoTenant: AllowNoTenant:
roles: roles:
- Admin - Admin
- InstallationAdmin
claims: [ ] claims: [ ]
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
@ -39,19 +37,17 @@ permissions:
# Users # Users
BrowseUser: BrowseUser:
roles: roles:
- TenantAdmin - Admin
clients: [ ] clients: [ ]
allowAnonymous: true allowAnonymous: true
allowAuthenticated: false allowAuthenticated: false
EditUser: EditUser:
roles: roles: [ ]
- TenantAdmin
clients: [ "opencdmp-api-dev" ] clients: [ "opencdmp-api-dev" ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
DeleteUser: DeleteUser:
roles: roles: [ ]
- TenantAdmin
claims: [ ] claims: [ ]
clients: [ "opencdmp-api-dev" ] clients: [ "opencdmp-api-dev" ]
allowAnonymous: false allowAnonymous: false
@ -59,6 +55,10 @@ permissions:
#Annotation #Annotation
BrowseAnnotation: BrowseAnnotation:
roles: roles:
- Admin
- InstallationAdmin
- TenantPlanManager
- TenantConfigManager
- TenantAdmin - TenantAdmin
entityAffiliated: true entityAffiliated: true
clients: [ ] clients: [ ]
@ -66,6 +66,10 @@ permissions:
allowAuthenticated: false allowAuthenticated: false
NewAnnotation: NewAnnotation:
roles: roles:
- Admin
- InstallationAdmin
- TenantPlanManager
- TenantConfigManager
- TenantAdmin - TenantAdmin
entityAffiliated: true entityAffiliated: true
clients: [ ] clients: [ ]
@ -73,12 +77,20 @@ permissions:
allowAuthenticated: false allowAuthenticated: false
EditAnnotation: EditAnnotation:
roles: roles:
- Admin
- InstallationAdmin
- TenantPlanManager
- TenantConfigManager
- TenantAdmin - TenantAdmin
clients: [ ] clients: [ ]
allowAnonymous: true allowAnonymous: true
allowAuthenticated: false allowAuthenticated: false
DeleteAnnotation: DeleteAnnotation:
roles: roles:
- Admin
- InstallationAdmin
- TenantPlanManager
- TenantConfigManager
- TenantAdmin - TenantAdmin
entityAffiliated: false entityAffiliated: false
clients: [ ] clients: [ ]
@ -87,12 +99,14 @@ permissions:
#Tenant Configuration #Tenant Configuration
BrowseTenantConfiguration: BrowseTenantConfiguration:
roles: roles:
- Admin
- TenantAdmin - TenantAdmin
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
EditTenantConfiguration: EditTenantConfiguration:
roles: roles:
- Admin
- TenantAdmin - TenantAdmin
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false

View File

@ -40,12 +40,6 @@ public class UserCredentialEntity {
public static final String _updatedAt = "updatedAt"; public static final String _updatedAt = "updatedAt";
@Column(name = "\"is_active\"", nullable = false)
@Convert(converter = IsActiveConverter.class)
private IsActive isActive;
public static final String _isActive = "isActive";
public UUID getId() { public UUID getId() {
return id; return id;
} }
@ -86,12 +80,4 @@ public class UserCredentialEntity {
this.updatedAt = updatedAt; this.updatedAt = updatedAt;
} }
public IsActive getIsActive() {
return isActive;
}
public void setIsActive(IsActive isActive) {
this.isActive = isActive;
}
} }

View File

@ -27,10 +27,6 @@ public class UserCredential {
public static final String _updatedAt = "updatedAt"; public static final String _updatedAt = "updatedAt";
private IsActive isActive;
public static final String _isActive = "isActive";
public UUID getId() { public UUID getId() {
return id; return id;
} }
@ -70,12 +66,4 @@ public class UserCredential {
public void setUpdatedAt(Instant updatedAt) { public void setUpdatedAt(Instant updatedAt) {
this.updatedAt = updatedAt; this.updatedAt = updatedAt;
} }
public IsActive getIsActive() {
return isActive;
}
public void setIsActive(IsActive isActive) {
this.isActive = isActive;
}
} }

View File

@ -62,12 +62,10 @@ public class UserCredentialDeleter implements Deleter {
Instant now = Instant.now(); Instant now = Instant.now();
for (UserCredentialEntity item : data) { for (UserCredentialEntity item : data) {
logger.trace("deleting item {}", item); logger.trace("deleting item {}", item.getId());
item.setIsActive(IsActive.Inactive); logger.trace("deleting item");
item.setUpdatedAt(now); this.entityManager.remove(item);
logger.trace("updating item"); logger.trace("deleted item");
this.entityManager.merge(item);
logger.trace("updated item");
} }
} }

View File

@ -182,9 +182,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
inClause.value(item); inClause.value(item);
predicates.add(inClause); predicates.add(inClause);
} }
if (this.isActives != null) {
predicates.add(queryContext.Root.get(UserCredentialEntity._isActive).in(isActives));
}
if (this.userIds != null) { if (this.userIds != null) {
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserCredentialEntity._userId)); CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserCredentialEntity._userId));
for (UUID item : this.userIds) for (UUID item : this.userIds)
@ -225,8 +222,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
return UserCredentialEntity._createdAt; return UserCredentialEntity._createdAt;
else if (item.match(UserCredential._updatedAt)) else if (item.match(UserCredential._updatedAt))
return UserCredentialEntity._updatedAt; return UserCredentialEntity._updatedAt;
else if (item.match(UserCredential._isActive))
return UserCredentialEntity._isActive;
else else
return null; return null;
} }
@ -239,7 +234,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
item.setUserId(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._userId, UUID.class)); item.setUserId(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._userId, UUID.class));
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, Instant.class)); item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, Instant.class));
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._updatedAt, Instant.class)); item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._updatedAt, Instant.class));
item.setIsActive(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, IsActive.class));
return item; return item;
} }

View File

@ -153,7 +153,6 @@ public class UserServiceImpl implements UserService {
data.setExternalId(model.getSubjectId()); data.setExternalId(model.getSubjectId());
data.setCreatedAt(Instant.now()); data.setCreatedAt(Instant.now());
data.setUpdatedAt(Instant.now()); data.setUpdatedAt(Instant.now());
data.setIsActive(IsActive.Active);
entityManager.persist(data); entityManager.persist(data);
} }
updatedCreatedIds.add(data.getId()); updatedCreatedIds.add(data.getId());

View File

@ -8,7 +8,7 @@ import java.util.List;
@ConfigurationProperties(prefix = "authorization") @ConfigurationProperties(prefix = "authorization")
public class AuthorizationProperties { public class AuthorizationProperties {
private String globalAdminRole; private List<String> globalAdminRoles;
private String tenantAdminRole; private String tenantAdminRole;
private String globalUserRole; private String globalUserRole;
private String tenantUserRole; private String tenantUserRole;
@ -16,12 +16,12 @@ public class AuthorizationProperties {
private List<String> allowedTenantRoles; private List<String> allowedTenantRoles;
private List<String> allowedGlobalRoles; private List<String> allowedGlobalRoles;
public String getGlobalAdminRole() { public List<String> getGlobalAdminRoles() {
return this.globalAdminRole; return globalAdminRoles;
} }
public void setGlobalAdminRole(String globalAdminRole) { public void setGlobalAdminRoles(List<String> globalAdminRoles) {
this.globalAdminRole = globalAdminRole; this.globalAdminRoles = globalAdminRoles;
} }
public String getTenantAdminRole() { public String getTenantAdminRole() {

View File

@ -244,4 +244,15 @@ public class ErrorThesaurusProperties {
public void setTenantCodeExists(ErrorDescription tenantCodeExists) { public void setTenantCodeExists(ErrorDescription tenantCodeExists) {
this.tenantCodeExists = tenantCodeExists; this.tenantCodeExists = tenantCodeExists;
} }
private ErrorDescription dmpNewVersionAlreadyCreatedDraft;
public ErrorDescription getDmpNewVersionAlreadyCreatedDraft() {
return dmpNewVersionAlreadyCreatedDraft;
}
public void setDmpNewVersionAlreadyCreatedDraft(ErrorDescription dmpNewVersionAlreadyCreatedDraft) {
this.dmpNewVersionAlreadyCreatedDraft = dmpNewVersionAlreadyCreatedDraft;
}
} }

View File

@ -408,7 +408,7 @@ public class DmpServiceImpl implements DmpService {
.groupIds(oldDmpEntity.getGroupId()) .groupIds(oldDmpEntity.getGroupId())
.isActive(IsActive.Active) .isActive(IsActive.Active)
.count(); .count();
if (notFinalizedCount > 0) throw new MyValidationException(this.errors.getModelValidation().getCode(), "Already created draft for this template"); if (notFinalizedCount > 0) throw new MyValidationException(this.errors.getDmpNewVersionAlreadyCreatedDraft().getCode(), this.errors.getDmpNewVersionAlreadyCreatedDraft().getMessage());
DmpEntity newDmp = new DmpEntity(); DmpEntity newDmp = new DmpEntity();
newDmp.setId(UUID.randomUUID()); newDmp.setId(UUID.randomUUID());

View File

@ -165,7 +165,7 @@ public class TenantServiceImpl implements TenantService {
try { try {
this.entityManager.disableTenantFilters(); this.entityManager.disableTenantFilters();
existingItems = this.queryFactory.query(UserRoleQuery.class).disableTracking().tenantIsSet(false).roles(this.authorizationProperties.getGlobalAdminRole()).collect(); existingItems = this.queryFactory.query(UserRoleQuery.class).disableTracking().tenantIsSet(false).roles(this.authorizationProperties.getGlobalAdminRoles()).collect();
userCredentialEntities = this.queryFactory.query(UserCredentialQuery.class).disableTracking().userIds(existingItems.stream().map(UserRoleEntity::getUserId).distinct().toList()).collect(); userCredentialEntities = this.queryFactory.query(UserCredentialQuery.class).disableTracking().userIds(existingItems.stream().map(UserRoleEntity::getUserId).distinct().toList()).collect();
List<String> keycloakIdsToAddToTenantGroup = new ArrayList<>(); List<String> keycloakIdsToAddToTenantGroup = new ArrayList<>();

View File

@ -1,5 +1,7 @@
authorization: authorization:
globalAdminRole: Admin globalAdminRoles:
- Admin
- InstallationAdmin
tenantAdminRole: TenantAdmin tenantAdminRole: TenantAdmin
globalUserRole: User globalUserRole: User
tenantUserRole: TenantUser tenantUserRole: TenantUser
@ -7,8 +9,9 @@ authorization:
allowedTenantRoles: allowedTenantRoles:
- TenantAdmin - TenantAdmin
- TenantUser - TenantUser
- TenantManager - TenantPlanManager
- TenantDescriptionTemplateEditor - TenantConfigManager
allowedGlobalRoles: allowedGlobalRoles:
- Admin - Admin
- InstallationAdmin
- User - User

View File

@ -80,3 +80,6 @@ error-thesaurus:
tenant-code-exists: tenant-code-exists:
code: 130 code: 130
message: Tenant code exists message: Tenant code exists
dmp-new-version-already-created-draft:
code: 131
message: Already created draft for this dmp

View File

@ -6,6 +6,8 @@ keycloak-resources:
groupId: a04fd333-f127-449e-8fc2-0626570a3899 groupId: a04fd333-f127-449e-8fc2-0626570a3899
Admin: Admin:
groupId: 299f18fe-e271-4625-a4c1-9c3eb313b2ea groupId: 299f18fe-e271-4625-a4c1-9c3eb313b2ea
InstallationAdmin:
groupId: 88a65fff-dffe-474a-a461-252ff4230203
tenantAuthorities: tenantAuthorities:
TenantAdmin: TenantAdmin:
parent: 1e650f57-8b7c-4f32-bf5b-e1a9147c597b parent: 1e650f57-8b7c-4f32-bf5b-e1a9147c597b
@ -13,9 +15,9 @@ keycloak-resources:
TenantUser: TenantUser:
parent: c7057c4d-e7dc-49ef-aa5d-02ad3a22bff8 parent: c7057c4d-e7dc-49ef-aa5d-02ad3a22bff8
roleAttributeValueStrategy: 'TenantUser:{tenantCode}' roleAttributeValueStrategy: 'TenantUser:{tenantCode}'
TenantManager: TenantConfigManager:
parent: d111bb2f-b4a6-4de7-ad22-5151ee1a508b parent: 09a6977b-719e-4e90-b3fc-3b394d82e05f
roleAttributeValueStrategy: 'TenantManager:{tenantCode}' roleAttributeValueStrategy: 'TenantConfigManager:{tenantCode}'
TenantDescriptionTemplateEditor: TenantPlanManager:
parent: 55cf7b17-c025-4065-8906-49f9f430f038 parent: 37d1fb0e-5e03-47bf-aefc-365c0670f84e
roleAttributeValueStrategy: 'TenantDescriptionTemplateEditor:{tenantCode}' roleAttributeValueStrategy: 'TenantPlanManager:{tenantCode}'

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,6 @@ CREATE TABLE IF NOT EXISTS public."ntf_UserCredential"
"external_id" character varying(512) COLLATE pg_catalog."default" NOT NULL, "external_id" character varying(512) COLLATE pg_catalog."default" NOT NULL,
"created_at" timestamp without time zone NOT NULL, "created_at" timestamp without time zone NOT NULL,
"updated_at" timestamp without time zone NOT NULL, "updated_at" timestamp without time zone NOT NULL,
"is_active" smallint NOT NULL DEFAULT 1,
"data" character varying COLLATE pg_catalog."default", "data" character varying COLLATE pg_catalog."default",
CONSTRAINT "ntf_UserCredential_pkey" PRIMARY KEY (id), CONSTRAINT "ntf_UserCredential_pkey" PRIMARY KEY (id),
CONSTRAINT "ntf_UserCredential_user_fkey" FOREIGN KEY ("user") CONSTRAINT "ntf_UserCredential_user_fkey" FOREIGN KEY ("user")

View File

@ -11,7 +11,6 @@ CREATE TABLE IF NOT EXISTS public."ant_UserCredential"
"external_id" character varying(512) COLLATE pg_catalog."default" NOT NULL, "external_id" character varying(512) COLLATE pg_catalog."default" NOT NULL,
"created_at" timestamp without time zone NOT NULL, "created_at" timestamp without time zone NOT NULL,
"updated_at" timestamp without time zone NOT NULL, "updated_at" timestamp without time zone NOT NULL,
"is_active" smallint NOT NULL DEFAULT 1,
"data" character varying COLLATE pg_catalog."default", "data" character varying COLLATE pg_catalog."default",
CONSTRAINT "ant_UserCredential_pkey" PRIMARY KEY (id), CONSTRAINT "ant_UserCredential_pkey" PRIMARY KEY (id),
CONSTRAINT "ant_UserCredential_user_fkey" FOREIGN KEY ("user") CONSTRAINT "ant_UserCredential_user_fkey" FOREIGN KEY ("user")

View File

@ -4,22 +4,22 @@ BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version; PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF; IF FOUND THEN RETURN; END IF;
CREATE TABLE IF NOT EXISTS public."ant_UserContactInfo" -- CREATE TABLE IF NOT EXISTS public."ant_UserContactInfo"
( -- (
"id" uuid NOT NULL, -- "id" uuid NOT NULL,
"user" uuid NOT NULL, -- "user" uuid NOT NULL,
"ordinal" integer NOT NULL DEFAULT 0, -- "ordinal" integer NOT NULL DEFAULT 0,
"type" smallint NOT NULL, -- "type" smallint NOT NULL,
"value" character varying(512) COLLATE pg_catalog."default" NOT NULL, -- "value" character varying(512) COLLATE pg_catalog."default" NOT NULL,
"created_at" timestamp without time zone NOT NULL, -- "created_at" timestamp without time zone NOT NULL,
"updated_at" timestamp without time zone NOT NULL, -- "updated_at" timestamp without time zone NOT NULL,
"is_active" smallint NOT NULL DEFAULT 1, -- "is_active" smallint NOT NULL DEFAULT 1,
CONSTRAINT "ant_UserContactInfo_pkey" PRIMARY KEY (id), -- CONSTRAINT "ant_UserContactInfo_pkey" PRIMARY KEY (id),
CONSTRAINT "ant_UserContactInfo_user_fkey" FOREIGN KEY ("user") -- CONSTRAINT "ant_UserContactInfo_user_fkey" FOREIGN KEY ("user")
REFERENCES public."ant_User" (id) MATCH SIMPLE -- REFERENCES public."ant_User" (id) MATCH SIMPLE
ON UPDATE NO ACTION -- ON UPDATE NO ACTION
ON DELETE NO ACTION -- ON DELETE NO ACTION
); -- );
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.058', '2024-02-28 12:00:00.000000+02', now(), 'Add table ant_UserContactInfo.'); INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.058', '2024-02-28 12:00:00.000000+02', now(), 'Add table ant_UserContactInfo.');

View File

@ -1,8 +1,11 @@
export enum AppRole { export enum AppRole {
Admin = "Admin", Admin = "Admin",
InstallationAdmin = "InstallationAdmin",
User = "User", User = "User",
TenantAdmin = "TenantAdmin", TenantAdmin = "TenantAdmin",
TenantUser = "TenantUser", TenantUser = "TenantUser",
TenantManager = "TenantManager", // TenantManager = "TenantManager",
TenantDescriptionTemplateEditor = "TenantDescriptionTemplateEditor" // TenantDescriptionTemplateEditor = "TenantDescriptionTemplateEditor"
TenantPlanManager = "TenantPlanManager",
TenantConfigManager = "TenantConfigManager"
} }

View File

@ -25,4 +25,5 @@ export enum ResponseErrorCode {
TenantConfigurationTypeCanNotChange = 128, TenantConfigurationTypeCanNotChange = 128,
MultipleTenantConfigurationTypeNotAllowed = 129, MultipleTenantConfigurationTypeNotAllowed = 129,
TenantCodeExists = 130, TenantCodeExists = 130,
DmpNewVersionAlreadyCreatedDraft = 131
} }

View File

@ -58,11 +58,12 @@ export class EnumUtils {
toAppRoleString(status: AppRole): string { toAppRoleString(status: AppRole): string {
switch (status) { switch (status) {
case AppRole.Admin: return this.language.instant('TYPES.APP-ROLE.ADMIN'); case AppRole.Admin: return this.language.instant('TYPES.APP-ROLE.ADMIN');
case AppRole.InstallationAdmin: return this.language.instant('TYPES.APP-ROLE.INSTALLATION-ADMIN');
case AppRole.User: return this.language.instant('TYPES.APP-ROLE.USER'); case AppRole.User: return this.language.instant('TYPES.APP-ROLE.USER');
case AppRole.TenantAdmin: return this.language.instant('TYPES.APP-ROLE.TENANT-ADMIN'); case AppRole.TenantAdmin: return this.language.instant('TYPES.APP-ROLE.TENANT-ADMIN');
case AppRole.TenantUser: return this.language.instant('TYPES.APP-ROLE.TENANT-USER'); case AppRole.TenantUser: return this.language.instant('TYPES.APP-ROLE.TENANT-USER');
case AppRole.TenantManager: return this.language.instant('TYPES.APP-ROLE.TENANT-MANAGER'); case AppRole.TenantPlanManager: return this.language.instant('TYPES.APP-ROLE.TENANT-PLAN-MANAGER');
case AppRole.TenantDescriptionTemplateEditor: return this.language.instant('TYPES.APP-ROLE.TENANT-DESCRIPTION-TEMPLATE-EDITOR'); case AppRole.TenantConfigManager: return this.language.instant('TYPES.APP-ROLE.TENANT-CONFIG-MANAGER');
} }
} }

View File

@ -4,7 +4,7 @@
<div *ngIf="!this.nowEditing"class="roles col-8"> <div *ngIf="!this.nowEditing"class="roles col-8">
<div *ngFor="let role of this.formGroup.get('roles').value" class="row"> <div *ngFor="let role of this.formGroup.get('roles').value" class="row">
<div class="col-auto p-0"> <div class="col-auto p-0">
<span class="user-role" [ngClass]="{'user': role == appRole.User, 'tenant-manager': role == appRole.TenantManager, 'admin': role == appRole.Admin, 'tenant-description-template-editor': role == appRole.TenantDescriptionTemplateEditor, 'tenant-admin': role == appRole.TenantAdmin, 'tenant-user': role == appRole.TenantUser}"> <span class="user-role" [ngClass]="{'user': role == appRole.User, 'tenant-plan-manager': role == appRole.TenantPlanManager, 'admin': role == appRole.Admin, 'installation-admin': role == appRole.InstallationAdmin, 'tenant-config-manager': role == appRole.TenantConfigManager, 'tenant-admin': role == appRole.TenantAdmin, 'tenant-user': role == appRole.TenantUser}">
{{enumUtils.toAppRoleString(role)}} {{enumUtils.toAppRoleString(role)}}
</span> </span>
</div> </div>

View File

@ -49,12 +49,12 @@
padding-right: 10px; padding-right: 10px;
} }
.tenant-manager { .tenant-plan-manager {
// display: flex; // display: flex;
// justify-content: center; // justify-content: center;
// align-items: center; // align-items: center;
min-width: 90px; min-width: 77px;
height: 28px; min-height: 28px;
color: #568b5a; color: #568b5a;
background: #9dd1a1 0% 0% no-repeat padding-box; background: #9dd1a1 0% 0% no-repeat padding-box;
border-radius: 44px; border-radius: 44px;
@ -85,6 +85,24 @@
padding-right: 10px; padding-right: 10px;
} }
.installation-admin {
// display: flex;
// justify-content: center;
// align-items: center;
min-width: 67px;
min-height: 28px;
color: #e75d01;
background: #dbaa4e3a 0% 0% no-repeat padding-box;
border-radius: 44px;
letter-spacing: 0.11px;
font-weight: 400;
opacity: 1;
margin-top: 0.5em;
margin-bottom: 0.5em;
padding-left: 10px;
padding-right: 10px;
}
.tenant-admin { .tenant-admin {
// display: flex; // display: flex;
// justify-content: center; // justify-content: center;
@ -103,7 +121,7 @@
padding-right: 10px; padding-right: 10px;
} }
.tenant-description-template-editor { .tenant-config-manager {
// display: flex; // display: flex;
// justify-content: center; // justify-content: center;
// align-items: center; // align-items: center;

View File

@ -54,7 +54,8 @@
"TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.", "TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.",
"TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.",
"MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.",
"TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code." "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.",
"DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan."
}, },
"FORM-VALIDATION-DISPLAY-DIALOG": { "FORM-VALIDATION-DISPLAY-DIALOG": {
"WARNING": "Warning!", "WARNING": "Warning!",
@ -1787,11 +1788,12 @@
}, },
"APP-ROLE": { "APP-ROLE": {
"ADMIN": "Admin", "ADMIN": "Admin",
"INSTALLATION-ADMIN": "Installation Admin",
"USER": "User", "USER": "User",
"TENANT-ADMIN": "Tenant Admin", "TENANT-ADMIN": "Tenant Admin",
"TENANT-USER": "Tenant User", "TENANT-USER": "Tenant User",
"TENANT-MANAGER": "Manager", "TENANT-PLAN-MANAGER": "Tenant Plan Manager",
"TENANT-DESCRIPTION-TEMPLATE-EDITOR": "Description Template Editor" "TENANT-CONFIG-MANAGER": "Tenant Configuration Manager"
}, },
"IS-ACTIVE": { "IS-ACTIVE": {
"ACTIVE": "Active", "ACTIVE": "Active",

View File

@ -88,6 +88,9 @@ export class HttpErrorHandlingService {
else if(errorResponse.error.code === ResponseErrorCode.TenantCodeExists){ else if(errorResponse.error.code === ResponseErrorCode.TenantCodeExists){
this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.TENANT-CODE-EXISTS"), SnackBarNotificationLevel.Error); this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.TENANT-CODE-EXISTS"), SnackBarNotificationLevel.Error);
} }
else if(errorResponse.error.code === ResponseErrorCode.DmpNewVersionAlreadyCreatedDraft){
this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DMP-NEW-VERSION-ALREADY-CREATED-DRAFT"), SnackBarNotificationLevel.Error);
}
else if (error.statusCode === 302 || error.statusCode === 400 || error.statusCode === 404) { else if (error.statusCode === 302 || error.statusCode === 400 || error.statusCode === 404) {
errorMessage ??= this.language.instant('GENERAL.SNACK-BAR.NOT-FOUND'); errorMessage ??= this.language.instant('GENERAL.SNACK-BAR.NOT-FOUND');
this.uiNotificationService.snackBarNotification(errorMessage, SnackBarNotificationLevel.Warning); this.uiNotificationService.snackBarNotification(errorMessage, SnackBarNotificationLevel.Warning);

View File

@ -4,20 +4,17 @@ permissions:
# Tenants # Tenants
BrowseTenant: BrowseTenant:
roles: roles: []
- Admin
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
EditTenant: EditTenant:
roles: roles: []
- Admin
clients: [ "opencdmp-api-dev" ] clients: [ "opencdmp-api-dev" ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
DeleteTenant: DeleteTenant:
roles: roles: []
- Admin
claims: [ ] claims: [ ]
clients: [ "opencdmp-api-dev" ] clients: [ "opencdmp-api-dev" ]
allowAnonymous: false allowAnonymous: false
@ -25,6 +22,7 @@ permissions:
AllowNoTenant: AllowNoTenant:
roles: roles:
- Admin - Admin
- InstallationAdmin
claims: [ ] claims: [ ]
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
@ -32,19 +30,17 @@ permissions:
# Users # Users
BrowseUser: BrowseUser:
roles: roles:
- TenantAdmin - Admin
clients: [ ] clients: [ ]
allowAnonymous: true allowAnonymous: true
allowAuthenticated: false allowAuthenticated: false
EditUser: EditUser:
roles: roles: []
- TenantAdmin
clients: [ "opencdmp-api-dev" ] clients: [ "opencdmp-api-dev" ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
DeleteUser: DeleteUser:
roles: roles: []
- TenantAdmin
claims: [ ] claims: [ ]
clients: [ "opencdmp-api-dev" ] clients: [ "opencdmp-api-dev" ]
allowAnonymous: false allowAnonymous: false
@ -52,19 +48,22 @@ permissions:
# UserContactInfo # UserContactInfo
BrowseUserContactInfo: BrowseUserContactInfo:
roles: roles:
- TenantAdmin - Admin
- InstallationAdmin
clients: [ "opencdmp-api-dev" ] clients: [ "opencdmp-api-dev" ]
allowAnonymous: true allowAnonymous: true
allowAuthenticated: false allowAuthenticated: false
EditUserContactInfo: EditUserContactInfo:
roles: roles:
- TenantAdmin - Admin
- InstallationAdmin
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
DeleteUserContactInfo: DeleteUserContactInfo:
roles: roles:
- TenantAdmin - Admin
- InstallationAdmin
claims: [ ] claims: [ ]
clients: [ "opencdmp-api-dev" ] clients: [ "opencdmp-api-dev" ]
allowAnonymous: false allowAnonymous: false
@ -72,25 +71,26 @@ permissions:
#Notification #Notification
BrowseNotification: BrowseNotification:
roles: roles:
- TenantAdmin - Admin
clients: [ ] clients: [ ]
allowAnonymous: true allowAnonymous: true
allowAuthenticated: false allowAuthenticated: false
EditNotification: EditNotification:
roles: roles:
- TenantAdmin - Admin
clients: [ ] clients: [ ]
allowAnonymous: true allowAnonymous: true
allowAuthenticated: false allowAuthenticated: false
DeleteNotification: DeleteNotification:
roles: roles:
- TenantAdmin - Admin
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
# TenantConfiguration # TenantConfiguration
BrowseTenantConfiguration: BrowseTenantConfiguration:
roles: roles:
- Admin
- TenantAdmin - TenantAdmin
claims: [ ] claims: [ ]
clients: [ ] clients: [ ]
@ -98,12 +98,14 @@ permissions:
allowAuthenticated: false allowAuthenticated: false
EditTenantConfiguration: EditTenantConfiguration:
roles: roles:
- Admin
- TenantAdmin - TenantAdmin
clients: [ "opencdmp-api-dev" ] clients: [ "opencdmp-api-dev" ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
DeleteTenantConfiguration: DeleteTenantConfiguration:
roles: roles:
- Admin
- TenantAdmin - TenantAdmin
clients: [ "opencdmp-api-dev" ] clients: [ "opencdmp-api-dev" ]
allowAnonymous: false allowAnonymous: false
@ -111,13 +113,13 @@ permissions:
#User Notification Preference #User Notification Preference
BrowseUserNotificationPreference: BrowseUserNotificationPreference:
roles: roles:
- TenantAdmin - Admin
clients: [ ] clients: [ ]
allowAnonymous: true allowAnonymous: true
allowAuthenticated: false allowAuthenticated: false
EditUserNotificationPreference: EditUserNotificationPreference:
roles: roles:
- TenantAdmin - Admin
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
@ -125,25 +127,26 @@ permissions:
# ViewPage Permissions # ViewPage Permissions
ViewNotificationPage: ViewNotificationPage:
roles: roles:
- TenantAdmin - Admin
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
ViewNotificationEventRulePage: ViewNotificationEventRulePage:
roles: roles:
- TenantAdmin - Admin
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
ViewInAppNotificationPage: ViewInAppNotificationPage:
roles: roles:
- TenantAdmin - Admin
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
ViewNotificationTemplatePage: ViewNotificationTemplatePage:
roles: roles:
- TenantAdmin - Admin
- TenantConfigManager
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
@ -151,19 +154,22 @@ permissions:
# Notification Template Permissions # Notification Template Permissions
BrowseNotificationTemplate: BrowseNotificationTemplate:
roles: roles:
- TenantAdmin - Admin
- TenantConfigManager
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
EditNotificationTemplate: EditNotificationTemplate:
roles: roles:
- TenantAdmin - Admin
- TenantConfigManager
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
DeleteNotificationTemplate: DeleteNotificationTemplate:
roles: roles:
- TenantAdmin - Admin
- TenantConfigManager
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
@ -171,13 +177,13 @@ permissions:
# In App Notification Permissions # In App Notification Permissions
BrowseInAppNotification: BrowseInAppNotification:
roles: roles:
- TenantAdmin - Admin
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
DeleteInAppNotification: DeleteInAppNotification:
roles: roles:
- TenantAdmin - Admin
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false

View File

@ -40,12 +40,6 @@ public class UserCredentialEntity {
public static final String _updatedAt = "updatedAt"; public static final String _updatedAt = "updatedAt";
@Column(name = "\"is_active\"", nullable = false)
@Convert(converter = IsActiveConverter.class)
private IsActive isActive;
public static final String _isActive = "isActive";
public UUID getId() { public UUID getId() {
return id; return id;
} }
@ -85,13 +79,4 @@ public class UserCredentialEntity {
public void setUpdatedAt(Instant updatedAt) { public void setUpdatedAt(Instant updatedAt) {
this.updatedAt = updatedAt; this.updatedAt = updatedAt;
} }
public IsActive getIsActive() {
return isActive;
}
public void setIsActive(IsActive isActive) {
this.isActive = isActive;
}
} }

View File

@ -27,10 +27,6 @@ public class UserCredential {
public static final String _updatedAt = "updatedAt"; public static final String _updatedAt = "updatedAt";
private IsActive isActive;
public static final String _isActive = "isActive";
public UUID getId() { public UUID getId() {
return id; return id;
} }
@ -70,12 +66,4 @@ public class UserCredential {
public void setUpdatedAt(Instant updatedAt) { public void setUpdatedAt(Instant updatedAt) {
this.updatedAt = updatedAt; this.updatedAt = updatedAt;
} }
public IsActive getIsActive() {
return isActive;
}
public void setIsActive(IsActive isActive) {
this.isActive = isActive;
}
} }

View File

@ -4,6 +4,8 @@ import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.notification.authorization.OwnedResource; import gr.cite.notification.authorization.OwnedResource;
import gr.cite.notification.authorization.Permission; import gr.cite.notification.authorization.Permission;
import gr.cite.notification.convention.ConventionService; import gr.cite.notification.convention.ConventionService;
import gr.cite.notification.model.InAppNotification;
import gr.cite.tools.data.censor.CensorFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.DataLogEntry; import gr.cite.tools.logging.DataLogEntry;
import gr.cite.tools.logging.LoggerService; import gr.cite.tools.logging.LoggerService;
@ -21,16 +23,20 @@ import java.util.UUID;
public class InAppNotificationCensor extends BaseCensor { public class InAppNotificationCensor extends BaseCensor {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(InAppNotificationCensor.class)); private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(InAppNotificationCensor.class));
private final AuthorizationService authService; private final AuthorizationService authService;
protected final CensorFactory censorFactory;
@Autowired @Autowired
public InAppNotificationCensor(ConventionService conventionService, AuthorizationService authService) { public InAppNotificationCensor(ConventionService conventionService, AuthorizationService authService, CensorFactory censorFactory) {
super(conventionService); super(conventionService);
this.authService = authService; this.authService = authService;
this.censorFactory = censorFactory;
} }
public void censor(FieldSet fields, UUID userId) { public void censor(FieldSet fields, UUID userId) {
logger.debug(new DataLogEntry("censoring fields", fields)); logger.debug(new DataLogEntry("censoring fields", fields));
if (this.isEmpty(fields)) return; if (this.isEmpty(fields)) return;
this.authService.authorizeAtLeastOneForce(userId != null ? List.of(new OwnedResource(userId)) : null, Permission.BrowseInAppNotification); this.authService.authorizeAtLeastOneForce(userId != null ? List.of(new OwnedResource(userId)) : null, Permission.BrowseInAppNotification);
FieldSet userFields = fields.extractPrefixed(this.asIndexerPrefix(InAppNotification.Field.USER));
this.censorFactory.censor(UserCensor.class).censor(userFields, userId);
} }
} }

View File

@ -62,12 +62,10 @@ public class UserCredentialDeleter implements Deleter {
Instant now = Instant.now(); Instant now = Instant.now();
for (UserCredentialEntity item : data) { for (UserCredentialEntity item : data) {
logger.trace("deleting item {}", item); logger.trace("deleting item {}", item.getId());
item.setIsActive(IsActive.Inactive); logger.trace("deleting item");
item.setUpdatedAt(now); this.entityManager.remove(item);
logger.trace("updating item"); logger.trace("deleted item");
this.entityManager.merge(item);
logger.trace("updated item");
} }
} }

View File

@ -28,8 +28,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
private Collection<UUID> excludedIds; private Collection<UUID> excludedIds;
private Collection<IsActive> isActives;
private Collection<UUID> userIds; private Collection<UUID> userIds;
private Collection<String> externalIds; private Collection<String> externalIds;
@ -75,21 +73,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
return this; return this;
} }
public UserCredentialQuery isActive(IsActive value) {
this.isActives = List.of(value);
return this;
}
public UserCredentialQuery isActive(IsActive... value) {
this.isActives = Arrays.asList(value);
return this;
}
public UserCredentialQuery isActive(Collection<IsActive> values) {
this.isActives = values;
return this;
}
public UserCredentialQuery userIds(UUID value) { public UserCredentialQuery userIds(UUID value) {
this.userIds = List.of(value); this.userIds = List.of(value);
return this; return this;
@ -182,9 +165,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
inClause.value(item); inClause.value(item);
predicates.add(inClause); predicates.add(inClause);
} }
if (this.isActives != null) {
predicates.add(queryContext.Root.get(UserCredentialEntity._isActive).in(isActives));
}
if (this.userIds != null) { if (this.userIds != null) {
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserCredentialEntity._userId)); CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserCredentialEntity._userId));
for (UUID item : this.userIds) for (UUID item : this.userIds)
@ -225,8 +205,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
return UserCredentialEntity._createdAt; return UserCredentialEntity._createdAt;
else if (item.match(UserCredential._updatedAt)) else if (item.match(UserCredential._updatedAt))
return UserCredentialEntity._updatedAt; return UserCredentialEntity._updatedAt;
else if (item.match(UserCredential._isActive))
return UserCredentialEntity._isActive;
else else
return null; return null;
} }
@ -239,7 +217,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
item.setUserId(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._userId, UUID.class)); item.setUserId(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._userId, UUID.class));
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, Instant.class)); item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, Instant.class));
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._updatedAt, Instant.class)); item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._updatedAt, Instant.class));
item.setIsActive(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, IsActive.class));
return item; return item;
} }

View File

@ -183,7 +183,6 @@ public class UserServiceImpl implements UserService {
private void persistUserCredential(List<UserTouchedIntegrationEvent.UserCredential> models, UUID userId) throws InvalidApplicationException { private void persistUserCredential(List<UserTouchedIntegrationEvent.UserCredential> models, UUID userId) throws InvalidApplicationException {
List<UserCredentialEntity> items = this.queryFactory.query(UserCredentialQuery.class) List<UserCredentialEntity> items = this.queryFactory.query(UserCredentialQuery.class)
.userIds(userId) .userIds(userId)
.isActive(IsActive.Active)
.collect(); .collect();
List<UUID> updatedCreatedIds = new ArrayList<>(); List<UUID> updatedCreatedIds = new ArrayList<>();
if (models != null) { if (models != null) {
@ -196,7 +195,6 @@ public class UserServiceImpl implements UserService {
data.setExternalId(model.getSubjectId()); data.setExternalId(model.getSubjectId());
data.setCreatedAt(Instant.now()); data.setCreatedAt(Instant.now());
data.setUpdatedAt(Instant.now()); data.setUpdatedAt(Instant.now());
data.setIsActive(IsActive.Active);
entityManager.persist(data); entityManager.persist(data);
} }
updatedCreatedIds.add(data.getId()); updatedCreatedIds.add(data.getId());