Commit 887ea1bb authored by Enriko Käsper's avatar Enriko Käsper
Browse files

Merge branch 'hotfix/TEIS-2010' into 'master'

Resolve TEIS-2010 "Hotfix/"

See merge request teis/roles-service!97
parents c10b2d28 fa154874
# Changelog
## [1.22.2] - 2021-10-25
* TEIS-2010: restrict RoleDefinition from saving null values in emailRecipient field
## [1.22.0] - 2021-09-27
* TEIS-2220: new privilege and role privileges
......
theGroup=ee.sm.ti.teis
theVersion=1.22.1
theVersion=1.22.2
commonsVersion=1.27.1
officeApiGatewayVersion=1.27.0
pluginVersion=1.3.0
......@@ -299,6 +299,24 @@ public class UpdateRoleDefinitionGwListenerTest extends RoleAppTestBase implemen
assertThat(response.getError().getViolations().get(0).getFieldName()).isEqualTo(ERROR_FIELD_NAME);
}
@Test
public void update_emailRecipient_restrictSavingNullValues() {
RoleDefinitionEntity initialEntity = dataService.getById(ID);
assertThat(initialEntity.getEmailRecipient()).isTrue();
payload = RoleDefinitionDto.builder()
.id(ID)
.roleType(EW)
.emailRecipient(null)
.name(TEST_CLASSIFIER_NAME)
.build();
request.setPayload(payload, requestMetaDTO);
UpdateRoleDefinitionResponse response = listener.update(request);
assertThat(response.getPayload().getEmailRecipient()).isTrue();
}
@Test
public void update_roleTypeI_roleCodeMissing_badRequest() {
payload = composeRoleDefinitionDto();
......
......@@ -70,6 +70,9 @@ public class RoleDefinitionComposeService {
} else {
entity.setRoleCode(existingEntity.getRoleCode());
}
if (dto.getEmailRecipient() == null) {
entity.setEmailRecipient(existingEntity.getEmailRecipient());
}
entity.setRoleType(existingEntity.getRoleType());
entity.setObjectStatus(existingEntity.getObjectStatus());
return entity;
......
--liquibase formatted sql
--changeset enriko:2021-10-25.TEIS-2010.update-email_recipient-for-specialists
UPDATE role_definition SET email_recipient = true, modified_at = now() WHERE role_code = 'SPECIALIST';
UPDATE execution_trigger SET execute = true WHERE id = 'cache-reinitialize';
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment