Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3400 bulk export rules incorrectly applied to group and patient exports #3403

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test
  • Loading branch information
olivia-you committed Feb 18, 2022
commit 3a8ef9222aeb600333de390bbc0f9b9a540c29a9
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class RuleBulkExportImplTest {
public void testDenyBulkRequestWithInvalidGroupId() {
oliviayou marked this conversation as resolved.
Show resolved Hide resolved
RuleBulkExportImpl myRule = new RuleBulkExportImpl("a");
myRule.setAppliesToGroupExportOnGroup("invalid group");
myRule.setMode(PolicyEnum.ALLOW);

BulkDataExportOptions options = new BulkDataExportOptions();
options.setExportStyle(BulkDataExportOptions.ExportStyle.GROUP);
Expand All @@ -42,4 +43,20 @@ public void testDenyBulkRequestWithInvalidGroupId() {
assertEquals(PolicyEnum.DENY, verdict.getDecision());
}

@Test
public void testAllowBulkRequestWithValidGroupId() {
RuleBulkExportImpl myRule = new RuleBulkExportImpl("a");
myRule.setAppliesToGroupExportOnGroup("Group/1");
myRule.setMode(PolicyEnum.ALLOW);

BulkDataExportOptions options = new BulkDataExportOptions();
options.setExportStyle(BulkDataExportOptions.ExportStyle.GROUP);
options.setGroupId(new IdDt("Group/1"));

when(myRequestDetails.getAttribute(any())).thenReturn(options);

AuthorizationInterceptor.Verdict verdict = myRule.applyRule(myOperation, myRequestDetails, null, null, null, myRuleApplier, myFlags, myPointcut);
assertEquals(PolicyEnum.ALLOW, verdict.getDecision());
}

}