SEBSERV-408 fixed cache issue

This commit is contained in:
anhefti 2024-02-28 09:36:25 +01:00
parent 4ceaf50385
commit eac6bccb5f
5 changed files with 19 additions and 9 deletions

View file

@ -163,6 +163,11 @@ public class ExamFormConfigs implements TemplateComposer {
.noEventPropagation() .noEventPropagation()
.publishIf(() -> examConfigEnabled && editable && !configurationTable.hasAnyContent()) .publishIf(() -> examConfigEnabled && editable && !configurationTable.hasAnyContent())
.newAction(ActionDefinition.EXAM_CONFIGURATION_EXAM_CONFIG_VIEW_PROP)
.withParentEntityKey(entityKey)
.withEntityKey(configKey)
.publishIf(() -> examConfigEnabled && readGrant && configurationTable.hasAnyContent(), false)
.newAction(ActionDefinition.EXAM_CONFIGURATION_MODIFY_FROM_LIST) .newAction(ActionDefinition.EXAM_CONFIGURATION_MODIFY_FROM_LIST)
.withParentEntityKey(entityKey) .withParentEntityKey(entityKey)
.withSelect( .withSelect(
@ -172,11 +177,6 @@ public class ExamFormConfigs implements TemplateComposer {
.noEventPropagation() .noEventPropagation()
.publishIf(() -> examConfigEnabled && editable && configurationTable.hasAnyContent(), false) .publishIf(() -> examConfigEnabled && editable && configurationTable.hasAnyContent(), false)
.newAction(ActionDefinition.EXAM_CONFIGURATION_EXAM_CONFIG_VIEW_PROP)
.withParentEntityKey(entityKey)
.withEntityKey(configKey)
.publishIf(() -> examConfigEnabled && readGrant && configurationTable.hasAnyContent(), false)
.newAction(ActionDefinition.EXAM_CONFIGURATION_DELETE_FROM_LIST) .newAction(ActionDefinition.EXAM_CONFIGURATION_DELETE_FROM_LIST)
.withEntityKey(entityKey) .withEntityKey(entityKey)
.withSelect( .withSelect(

View file

@ -216,7 +216,9 @@ public interface ExamDAO extends ActivatableEntityDAO<Exam, Exam>, BulkActionSup
* *
* @param examId the Exam identifier */ * @param examId the Exam identifier */
@CacheEvict( @CacheEvict(
cacheNames = ExamSessionCacheService.CACHE_NAME_RUNNING_EXAM, cacheNames = {
ExamSessionCacheService.CACHE_NAME_RUNNING_EXAM,
ExamSessionCacheService.CACHE_NAME_SEB_CONFIG_EXAM },
key = "#examId") key = "#examId")
void markUpdate(Long examId); void markUpdate(Long examId);

View file

@ -10,11 +10,9 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.session.impl;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.security.Principal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;

View file

@ -13,6 +13,8 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.mybatis.dynamic.sql.SqlTable; import org.mybatis.dynamic.sql.SqlTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.validation.FieldError; import org.springframework.validation.FieldError;
@ -57,6 +59,8 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.validation.BeanValidationSe
@RequestMapping("${sebserver.webservice.api.admin.endpoint}" + API.EXAM_CONFIGURATION_MAP_ENDPOINT) @RequestMapping("${sebserver.webservice.api.admin.endpoint}" + API.EXAM_CONFIGURATION_MAP_ENDPOINT)
public class ExamConfigurationMappingController extends EntityController<ExamConfigurationMap, ExamConfigurationMap> { public class ExamConfigurationMappingController extends EntityController<ExamConfigurationMap, ExamConfigurationMap> {
private static final Logger log = LoggerFactory.getLogger(ExamConfigurationMappingController.class);
private final ExamDAO examDao; private final ExamDAO examDao;
private final ConfigurationNodeDAO configurationNodeDAO; private final ConfigurationNodeDAO configurationNodeDAO;
private final ExamConfigUpdateService examConfigUpdateService; private final ExamConfigUpdateService examConfigUpdateService;
@ -139,6 +143,12 @@ public class ExamConfigurationMappingController extends EntityController<ExamCon
.map(this::checkPasswordMatch); .map(this::checkPasswordMatch);
} }
@Override
protected Result<ExamConfigurationMap> notifySaved(final ExamConfigurationMap entity) {
examDao.markUpdate(entity.examId);
return super.notifySaved(entity);
}
@Override @Override
@RequestMapping( @RequestMapping(
method = RequestMethod.POST, method = RequestMethod.POST,

View file

@ -679,7 +679,7 @@ sebserver.exam.configuration.list.pleaseSelect=At first please select an exam co
sebserver.exam.configuration.action.noconfig.message=There is currently no exam configuration to select.<br/>Please create one in Exam Configurations sebserver.exam.configuration.action.noconfig.message=There is currently no exam configuration to select.<br/>Please create one in Exam Configurations
sebserver.exam.configuration.action.list.new=Add Exam Configuration sebserver.exam.configuration.action.list.new=Add Exam Configuration
sebserver.exam.configuration.action.list.modify=Edit Exam Configuration sebserver.exam.configuration.action.list.modify=Edit Encryption Password
sebserver.exam.configuration.action.list.view=View Exam Configuration sebserver.exam.configuration.action.list.view=View Exam Configuration
sebserver.exam.configuration.action.list.delete=Remove Exam Configuration sebserver.exam.configuration.action.list.delete=Remove Exam Configuration
sebserver.exam.configuration.action.save=Save Exam Configuration sebserver.exam.configuration.action.save=Save Exam Configuration