From 915c9d1e3cbd3314864f708ff1ecc81d84099d2d 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)