Updating censors for dmp and description entities

This commit is contained in:
Thomas Georgios Giannos 2023-10-25 14:49:37 +03:00
parent 1b66d19bde
commit c169a103b7
2 changed files with 14 additions and 1 deletions

View File

@ -2,7 +2,9 @@ package eu.eudat.model.censorship;
import eu.eudat.authorization.Permission;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.Description;
import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.tools.data.censor.CensorFactory;
import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.DataLogEntry;
import gr.cite.tools.logging.LoggerService;
@ -21,9 +23,12 @@ public class DescriptionCensor extends BaseCensor {
protected final AuthorizationService authService;
public DescriptionCensor(ConventionService conventionService, AuthorizationService authService) {
protected final CensorFactory censorFactory;
public DescriptionCensor(ConventionService conventionService, AuthorizationService authService, CensorFactory censorFactory) {
super(conventionService);
this.authService = authService;
this.censorFactory = censorFactory;
}
public void censor(FieldSet fields, UUID userId) {
@ -32,6 +37,9 @@ public class DescriptionCensor extends BaseCensor {
return;
this.authService.authorizeForce(Permission.BrowseDescription);
FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(Description._dmp));
this.censorFactory.censor(DmpCensor.class).censor(dmpFields, userId);
}
}

View File

@ -2,6 +2,7 @@ package eu.eudat.model.censorship;
import eu.eudat.authorization.Permission;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.Dmp;
import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.tools.data.censor.CensorFactory;
import gr.cite.tools.fieldset.FieldSet;
@ -21,6 +22,7 @@ public class DmpCensor extends BaseCensor {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpCensor.class));
protected final AuthorizationService authService;
protected final CensorFactory censorFactory;
public DmpCensor(ConventionService conventionService,
@ -37,6 +39,9 @@ public class DmpCensor extends BaseCensor {
return;
this.authService.authorizeForce(Permission.BrowseDmp);
FieldSet dmpDescriptionsFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._dmpDescriptions));
this.censorFactory.censor(DescriptionCensor.class).censor(dmpDescriptionsFields, userId);
}
}