mirror of
https://github.com/pcvolkmer/onkostar-plugin-dnpm.git
synced 2025-07-04 10:02:55 +00:00
Erlaube keinen Protokollauszug, wenn keine Berechtigung auf Zielformular
Dies verhindert Zugriff auf den Protokollauszug beliebiger MTB-Formulare durch "Erraten" von IDs. Liegt keine Berechtigung für das Therapieplan-Formular (mit gegebener ID) vor, können auch keine referenzierten MTB-Formulare abgerufen und deren Inhalt für den Protokollauszug verwendet werden.
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
package DNPM.analyzer;
|
||||
|
||||
import DNPM.security.DelegatingDataBasedPermissionEvaluator;
|
||||
import DNPM.security.PermissionType;
|
||||
import DNPM.services.*;
|
||||
import DNPM.services.mtb.MtbService;
|
||||
import de.itc.onkostar.api.IOnkostarApi;
|
||||
@ -40,11 +42,14 @@ class TherapieplanAnalyzerTest {
|
||||
@Mock
|
||||
private MtbService mtbService;
|
||||
|
||||
@Mock
|
||||
private DelegatingDataBasedPermissionEvaluator permissionEvaluator;
|
||||
|
||||
private TherapieplanAnalyzer therapieplanAnalyzer;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
this.therapieplanAnalyzer = new TherapieplanAnalyzer(studienService, therapieplanServiceFactory, mtbService);
|
||||
this.therapieplanAnalyzer = new TherapieplanAnalyzer(studienService, therapieplanServiceFactory, mtbService, permissionEvaluator);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -94,6 +99,8 @@ class TherapieplanAnalyzerTest {
|
||||
when(this.therapieplanServiceFactory.currentUsableInstance())
|
||||
.thenReturn(therapieplanService);
|
||||
|
||||
when(this.permissionEvaluator.hasPermission(any(), anyInt(), anyString(), any(PermissionType.class))).thenReturn(true);
|
||||
|
||||
var input = Map.of("id", (Object) 1234);
|
||||
this.therapieplanAnalyzer.getProtokollauszug(input);
|
||||
|
||||
@ -102,4 +109,15 @@ class TherapieplanAnalyzerTest {
|
||||
assertThat(captor.getValue()).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotRequestProtokollauszugDueToNoPermission() {
|
||||
when(this.permissionEvaluator.hasPermission(any(), anyInt(), anyString(), any(PermissionType.class)))
|
||||
.thenReturn(false);
|
||||
|
||||
var input = Map.of("id", (Object) 1234);
|
||||
this.therapieplanAnalyzer.getProtokollauszug(input);
|
||||
|
||||
verify(mtbService, times(0)).getProtocol(anyList());
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user