This commit is contained in:
anhefti 2019-06-06 10:43:04 +02:00
parent bba89c952e
commit f53243e001
5 changed files with 16 additions and 15 deletions

View file

@ -13,7 +13,7 @@
</Match>
<Match>
<Class name="ch.ethz.seb.sebserver.gbl.api.ExamAPIDiscovery" />
<Bug pattern="UrF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" />
<Bug pattern="UrF" />
</Match>
<Match>
<Class name="ch.ethz.seb.sebserver.gui.widget.*" />

View file

@ -79,11 +79,11 @@ public final class UserMod implements UserAccount {
public final Set<String> roles;
@NotNull(message = "user:newPassword:notNull")
@Size(min = 8, max = 255, message = "user:password:size:{min}:{max}:${validatedValue}")
@Size(min = 8, max = 255, message = "user:newPassword:size:{min}:{max}:${validatedValue}")
@JsonProperty(PasswordChange.ATTR_NAME_NEW_PASSWORD)
private final String newPassword;
@NotNull(message = "user:retypedNewPassword:notNull")
@NotNull(message = "user:confirmNewPassword:notNull")
@JsonProperty(PasswordChange.ATTR_NAME_CONFIRM_NEW_PASSWORD)
private final String confirmNewPassword;

View file

@ -81,12 +81,12 @@ public class PassworFieldBuilder implements InputFieldBuilder {
InputFieldBuilder.createErrorLabel(innerGrid));
final Listener valueChangeEventListener = event -> {
passwordInputField.clearError();
final String pwd = passwordInput.getText();
final String confirm = confirmInput.getText();
if (passwordInputField.initValue != null && passwordInputField.initValue.equals(pwd)) {
System.out.println("*********************************** ignore Password set");
return;
}
@ -103,7 +103,6 @@ public class PassworFieldBuilder implements InputFieldBuilder {
final String hashedPWD = passwordInputField.getValue();
if (hashedPWD != null) {
passwordInputField.clearError();
viewContext.getValueChangeListener().valueChanged(
viewContext,
attribute,

View file

@ -83,6 +83,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
.withBasePrivilege(PrivilegeType.WRITE)
.andForRole(UserRole.INSTITUTIONAL_ADMIN)
.withInstitutionalPrivilege(PrivilegeType.WRITE)
.andForRole(UserRole.EXAM_ADMIN)
.withInstitutionalPrivilege(PrivilegeType.WRITE)
.create();
// grants for lms setup

View file

@ -294,6 +294,15 @@ public class ConfigurationDAOImpl implements ConfigurationDAO {
// get follow-up configuration id
final ConfigurationRecord followup = getFollowupConfigurationRecord(configurationNodeId);
// delete all values of the follow-up
this.configurationValueRecordMapper
.deleteByExample()
.where(
ConfigurationValueRecordDynamicSqlSupport.configurationId,
isEqualTo(followup.getId()))
.build()
.execute();
// restore all current values of the follow-up with historic values
// TODO batch here for better performance
historicValues.stream()
@ -304,16 +313,7 @@ public class ConfigurationDAOImpl implements ConfigurationDAO {
historicValRec.getConfigurationAttributeId(),
historicValRec.getListIndex(),
historicValRec.getValue()))
.forEach(newValRec -> this.configurationValueRecordMapper
.updateByExample(newValRec)
.where(
ConfigurationValueRecordDynamicSqlSupport.configurationId,
isEqualTo(followup.getId()))
.and(
ConfigurationValueRecordDynamicSqlSupport.configurationAttributeId,
isEqualTo(newValRec.getConfigurationAttributeId()))
.build()
.execute());
.forEach(newValRec -> this.configurationValueRecordMapper.insert(newValRec));
return followup;
})