Updating censors for dmp and description entities
This commit is contained in:
parent
1b66d19bde
commit
c169a103b7
|
@ -2,7 +2,9 @@ package eu.eudat.model.censorship;
|
||||||
|
|
||||||
import eu.eudat.authorization.Permission;
|
import eu.eudat.authorization.Permission;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.Description;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
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.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,9 +23,12 @@ public class DescriptionCensor extends BaseCensor {
|
||||||
|
|
||||||
protected final AuthorizationService authService;
|
protected final AuthorizationService authService;
|
||||||
|
|
||||||
public DescriptionCensor(ConventionService conventionService, AuthorizationService authService) {
|
protected final CensorFactory censorFactory;
|
||||||
|
|
||||||
|
public DescriptionCensor(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) {
|
||||||
|
@ -32,6 +37,9 @@ public class DescriptionCensor extends BaseCensor {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.authService.authorizeForce(Permission.BrowseDescription);
|
this.authService.authorizeForce(Permission.BrowseDescription);
|
||||||
|
|
||||||
|
FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(Description._dmp));
|
||||||
|
this.censorFactory.censor(DmpCensor.class).censor(dmpFields, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.eudat.model.censorship;
|
||||||
|
|
||||||
import eu.eudat.authorization.Permission;
|
import eu.eudat.authorization.Permission;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.Dmp;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.censor.CensorFactory;
|
import gr.cite.tools.data.censor.CensorFactory;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
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));
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpCensor.class));
|
||||||
|
|
||||||
protected final AuthorizationService authService;
|
protected final AuthorizationService authService;
|
||||||
|
|
||||||
protected final CensorFactory censorFactory;
|
protected final CensorFactory censorFactory;
|
||||||
|
|
||||||
public DmpCensor(ConventionService conventionService,
|
public DmpCensor(ConventionService conventionService,
|
||||||
|
@ -37,6 +39,9 @@ public class DmpCensor extends BaseCensor {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.authService.authorizeForce(Permission.BrowseDmp);
|
this.authService.authorizeForce(Permission.BrowseDmp);
|
||||||
|
|
||||||
|
FieldSet dmpDescriptionsFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._dmpDescriptions));
|
||||||
|
this.censorFactory.censor(DescriptionCensor.class).censor(dmpDescriptionsFields, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue