diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamTemplateForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamTemplateForm.java index feb4c1d0..3243e17a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamTemplateForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamTemplateForm.java @@ -45,7 +45,6 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetIndicator import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.NewExamTemplate; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.SaveExamTemplate; import ch.ethz.seb.sebserver.gui.service.remote.webservice.auth.CurrentUser; -import ch.ethz.seb.sebserver.gui.service.remote.webservice.auth.CurrentUser.EntityGrantCheck; import ch.ethz.seb.sebserver.gui.service.remote.webservice.auth.CurrentUser.GrantCheck; import ch.ethz.seb.sebserver.gui.table.ColumnDefinition; import ch.ethz.seb.sebserver.gui.table.EntityTable; @@ -192,7 +191,7 @@ public class ExamTemplateForm implements TemplateComposer { ? this.restService.getRestCall(NewExamTemplate.class) : this.restService.getRestCall(SaveExamTemplate.class)); - final boolean proctoringEnabled = this.restService + final boolean proctoringEnabled = !isNew && this.restService .getBuilder(GetExamTemplateProctoringSettings.class) .withURIVariable(API.PARAM_MODEL_ID, entityKey.modelId) .call() @@ -200,8 +199,8 @@ public class ExamTemplateForm implements TemplateComposer { .getOr(false); final GrantCheck userGrant = currentUser.grantCheck(EntityType.EXAM_TEMPLATE); - final EntityGrantCheck userGrantCheck = currentUser.entityGrantCheck(examTemplate); - final boolean modifyGrant = userGrantCheck.m(); +// final EntityGrantCheck userGrantCheck = currentUser.entityGrantCheck(examTemplate); +// final boolean modifyGrant = userGrantCheck.m(); // propagate content actions to action-pane this.pageService.pageActionBuilder(formContext.clearEntityKeys()) @@ -228,13 +227,13 @@ public class ExamTemplateForm implements TemplateComposer { .newAction(ActionDefinition.EXAM_TEMPLATE_PROCTORING_ON) .withEntityKey(entityKey) - .withExec(this.proctoringSettingsPopup.settingsFunction(this.pageService, modifyGrant)) + .withExec(this.proctoringSettingsPopup.settingsFunction(this.pageService, userGrant.im())) .noEventPropagation() .publishIf(() -> proctoringEnabled && readonly) .newAction(ActionDefinition.EXAM_TEMPLATE_PROCTORING_OFF) .withEntityKey(entityKey) - .withExec(this.proctoringSettingsPopup.settingsFunction(this.pageService, modifyGrant)) + .withExec(this.proctoringSettingsPopup.settingsFunction(this.pageService, userGrant.im())) .noEventPropagation() .publishIf(() -> !proctoringEnabled && readonly); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/AuthorizationServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/AuthorizationServiceImpl.java index 7f84347b..d4d40e1c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/AuthorizationServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/AuthorizationServiceImpl.java @@ -129,7 +129,7 @@ public class AuthorizationServiceImpl implements AuthorizationService { .forRole(UserRole.SEB_SERVER_ADMIN) .withBasePrivilege(PrivilegeType.READ) .andForRole(UserRole.INSTITUTIONAL_ADMIN) - .withInstitutionalPrivilege(PrivilegeType.READ) + .withInstitutionalPrivilege(PrivilegeType.WRITE) .andForRole(UserRole.EXAM_ADMIN) .withInstitutionalPrivilege(PrivilegeType.WRITE) .create(); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java index 3dc88fe7..fc6d3322 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java @@ -69,8 +69,6 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl.moodle.legacy.Mood @WebServiceProfile public class ExamDAOImpl implements ExamDAO { - //public static final String FAILED_TO_LOAD_QUIZ_DATA_MARK = "[FAILED TO LOAD DATA FROM LMS]"; - private final ExamRecordMapper examRecordMapper; private final ExamRecordDAO examRecordDAO; private final ApplicationEventPublisher applicationEventPublisher; @@ -979,7 +977,9 @@ public class ExamDAOImpl implements ExamDAO { .collect(Utils.toSingleton()) .getValue(); } catch (final Exception e) { - log.error("Failed to get former name: examId: {} error: {}", id, e.getMessage()); + if (log.isDebugEnabled()) { + log.warn("Failed to get former name: examId: {} error: {}", id, e.getMessage()); + } return null; } } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamTemplateDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamTemplateDAOImpl.java index a5108e47..da0eed2a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamTemplateDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamTemplateDAOImpl.java @@ -534,11 +534,13 @@ public class ExamTemplateDAOImpl implements ExamTemplateDAO { } } - private void checkUniqueIndicatorName(final IndicatorTemplate indicatorTemplate, + private void checkUniqueIndicatorName( + final IndicatorTemplate indicatorTemplate, final Collection indicators) { + // check unique name indicators.stream() - .filter(it -> Objects.equals(it.name, indicatorTemplate.name)) + .filter(it -> !Objects.equals(it, indicatorTemplate) && Objects.equals(it.name, indicatorTemplate.name)) .findAny() .ifPresent(it -> { throw new FieldValidationException(