From 372ec9d4531b33473019549ffcf5f28b68384084 Mon Sep 17 00:00:00 2001 From: Sergiu Dumitriu Date: Wed, 24 Jul 2024 12:28:17 -0400 Subject: [PATCH] CARDS-2549 / CARDS-2555: Only consider patient forms in the cards:unsubmitted permission restriction --- .../unsubmitted/UnsubmittedFormsRestrictionPattern.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/permissions-unsubmitted/src/main/java/io/uhndata/cards/permissions/internal/unsubmitted/UnsubmittedFormsRestrictionPattern.java b/modules/permissions-unsubmitted/src/main/java/io/uhndata/cards/permissions/internal/unsubmitted/UnsubmittedFormsRestrictionPattern.java index 5ea84c4d8d..8ff5663949 100644 --- a/modules/permissions-unsubmitted/src/main/java/io/uhndata/cards/permissions/internal/unsubmitted/UnsubmittedFormsRestrictionPattern.java +++ b/modules/permissions-unsubmitted/src/main/java/io/uhndata/cards/permissions/internal/unsubmitted/UnsubmittedFormsRestrictionPattern.java @@ -101,13 +101,14 @@ public boolean matches(final Tree tree, final PropertyState property) private boolean isUnsubmitted(final Tree form) { + boolean isSubmitted = false; + boolean isPatientForm = false; PropertyState flags = form.getProperty("statusFlags"); for (int i = 0; i < flags.count(); ++i) { - if ("SUBMITTED".equals(flags.getValue(Type.STRING, i))) { - return false; - } + isSubmitted |= "SUBMITTED".equals(flags.getValue(Type.STRING, i)); + isPatientForm |= "PATIENT SURVEY".equals(flags.getValue(Type.STRING, i)); } - return true; + return isPatientForm && !isSubmitted; } private boolean isForm(final Tree node)