Skip to content
Snippets Groups Projects
Commit a1987b41 authored by Felix Reichenbach's avatar Felix Reichenbach
Browse files

OZG-7726 remove role check for forward by ozg-cloud link

parent 0b62b56f
Branches
Tags
1 merge request!20OZG-7726 remove role check for forward by ozg-cloud link
......@@ -62,17 +62,13 @@ class ForwardingVorgangWithEingangProcessor implements RepresentationModelProces
}
boolean isForwardableByOzgCloud(VorgangWithEingang vorgang) {
return featureToggleProperties.isForwardByOzgCloudEnabled() && isStatusNeu(vorgang) && isVerwaltungUser();
return featureToggleProperties.isForwardByOzgCloudEnabled() && isStatusNeu(vorgang);
}
private boolean isStatusNeu(VorgangWithEingang vorgang) {
return vorgang.getStatus() == VorgangStatus.NEU;
}
private boolean isVerwaltungUser() {
return userService.hasRole(UserRole.VERWALTUNG_USER);
}
private Link buildForwardByOzgCloudLink(VorgangWithEingang vorgang) {
return linkTo(methodOn(CommandController.CommandByRelationController.class).createCommand(vorgang.getId(), vorgang.getId(),
vorgang.getVersion(), null)).withRel(REL_FORWARD_BY_OZGCLOUD);
......
......@@ -205,16 +205,6 @@ class ForwardingVorgangWithEingangProcessorTest {
assertThat(forwardableByOzgCloud).isFalse();
}
@ParameterizedTest
@EnumSource
void shouldNotCallUserService(VorgangStatus status) {
var vorgang = VorgangWithEingangTestFactory.createBuilder().status(status).build();
processor.isForwardableByOzgCloud(vorgang);
verify(userService, never()).hasRole(any());
}
}
@Nested
......@@ -236,16 +226,6 @@ class ForwardingVorgangWithEingangProcessorTest {
assertThat(forwardableByOzgCloud).isFalse();
}
@ParameterizedTest
@EnumSource(mode = Mode.EXCLUDE, names = { "NEU" })
void shouldNotCallUserService(VorgangStatus status) {
var vorgang = VorgangWithEingangTestFactory.createBuilder().status(status).build();
processor.isForwardableByOzgCloud(vorgang);
verify(userService, never()).hasRole(any());
}
}
@Nested
......@@ -254,20 +234,10 @@ class ForwardingVorgangWithEingangProcessorTest {
private final VorgangWithEingang newVorgang = VorgangWithEingangTestFactory.createBuilder().status(VorgangStatus.NEU).build();
@Test
void shouldCheckUserRole() {
processor.isForwardableByOzgCloud(newVorgang);
verify(userService).hasRole(UserRole.VERWALTUNG_USER);
}
@ParameterizedTest
@ValueSource(booleans = { true, false })
void shouldReturnValueOfHasVerwaltungUserRole(boolean isVerwaltungUser) {
when(userService.hasRole(UserRole.VERWALTUNG_USER)).thenReturn(isVerwaltungUser);
void shouldReturnTrue() {
var forwardableByOzgCloud = processor.isForwardableByOzgCloud(newVorgang);
assertThat(forwardableByOzgCloud).isEqualTo(isVerwaltungUser);
assertThat(forwardableByOzgCloud).isTrue();
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment