2024-02-06 11:27:47 +01:00
|
|
|
package eu.eudat.model.censorship.descriptionreference;
|
|
|
|
|
|
|
|
import eu.eudat.authorization.Permission;
|
|
|
|
import eu.eudat.convention.ConventionService;
|
|
|
|
import eu.eudat.model.censorship.BaseCensor;
|
|
|
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
|
|
|
import gr.cite.tools.fieldset.FieldSet;
|
|
|
|
import gr.cite.tools.logging.DataLogEntry;
|
|
|
|
import gr.cite.tools.logging.LoggerService;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
|
|
import org.springframework.context.annotation.Scope;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
@Component
|
|
|
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
|
|
public class DescriptionReferenceDataCensor extends BaseCensor {
|
|
|
|
|
|
|
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DescriptionReferenceDataCensor.class));
|
|
|
|
|
|
|
|
protected final AuthorizationService authService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
public DescriptionReferenceDataCensor(ConventionService conventionService,
|
|
|
|
AuthorizationService authService) {
|
|
|
|
super(conventionService);
|
|
|
|
this.authService = authService;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void censor(FieldSet fields, UUID userId) {
|
|
|
|
logger.debug(new DataLogEntry("censoring fields", fields));
|
|
|
|
if (fields == null || fields.isEmpty())
|
|
|
|
return;
|
|
|
|
|
2024-03-26 17:44:59 +01:00
|
|
|
this.authService.authorizeForce(Permission.BrowseDescriptionReference, Permission.DeferredAffiliation);
|
2024-02-06 11:27:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|