Allow transactions and batches with transaction permission in
AuthorizationInterceptor
This commit is contained in:
parent
0fbe897ca4
commit
4e252063b8
|
@ -83,7 +83,8 @@ public interface IAuthRuleBuilderRule {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This rule applies to the FHIR transaction operation. Transaction is a special
|
* This rule applies to the FHIR transaction operation. Transaction is a special
|
||||||
* case in that it bundles other operations
|
* case in that it bundles other operations. This permission also allows FHIR
|
||||||
|
* batch to be performed.
|
||||||
*/
|
*/
|
||||||
IAuthRuleBuilderRuleTransaction transaction();
|
IAuthRuleBuilderRuleTransaction transaction();
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,6 @@ public class RuleBuilder implements IAuthRuleBuilder {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAuthRuleBuilderRuleTransaction transaction() {
|
public IAuthRuleBuilderRuleTransaction transaction() {
|
||||||
myRuleOp = RuleOpEnum.TRANSACTION;
|
|
||||||
return new RuleBuilderRuleTransaction();
|
return new RuleBuilderRuleTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,11 +519,20 @@ public class RuleBuilder implements IAuthRuleBuilder {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAuthRuleBuilderRuleOpClassifierFinished andApplyNormalRules() {
|
public IAuthRuleBuilderRuleOpClassifierFinished andApplyNormalRules() {
|
||||||
|
// Allow transaction
|
||||||
RuleImplOp rule = new RuleImplOp(myRuleName);
|
RuleImplOp rule = new RuleImplOp(myRuleName);
|
||||||
rule.setMode(myRuleMode);
|
rule.setMode(myRuleMode);
|
||||||
rule.setOp(myRuleOp);
|
rule.setOp(RuleOpEnum.TRANSACTION);
|
||||||
rule.setTransactionAppliesToOp(TransactionAppliesToEnum.ANY_OPERATION);
|
rule.setTransactionAppliesToOp(TransactionAppliesToEnum.ANY_OPERATION);
|
||||||
myRules.add(rule);
|
myRules.add(rule);
|
||||||
|
|
||||||
|
// Allow batch
|
||||||
|
rule = new RuleImplOp(myRuleName);
|
||||||
|
rule.setMode(myRuleMode);
|
||||||
|
rule.setOp(RuleOpEnum.BATCH);
|
||||||
|
rule.setTransactionAppliesToOp(TransactionAppliesToEnum.ANY_OPERATION);
|
||||||
|
myRules.add(rule);
|
||||||
|
|
||||||
return new RuleBuilderFinished(rule);
|
return new RuleBuilderFinished(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,7 @@ public class AuthorizationInterceptorDstu2Test {
|
||||||
httpPost.setEntity(createFhirResourceEntity(input));
|
httpPost.setEntity(createFhirResourceEntity(input));
|
||||||
status = ourClient.execute(httpPost);
|
status = ourClient.execute(httpPost);
|
||||||
extractResponseAndClose(status);
|
extractResponseAndClose(status);
|
||||||
assertEquals(403, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -495,7 +495,7 @@ public class AuthorizationInterceptorDstu3Test {
|
||||||
httpPost.setEntity(createFhirResourceEntity(input));
|
httpPost.setEntity(createFhirResourceEntity(input));
|
||||||
status = ourClient.execute(httpPost);
|
status = ourClient.execute(httpPost);
|
||||||
extractResponseAndClose(status);
|
extractResponseAndClose(status);
|
||||||
assertEquals(403, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -469,7 +469,7 @@ public class AuthorizationInterceptorR4Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatchWhenOnlyTransactionAllowed() throws Exception {
|
public void testBatchAllowed() throws Exception {
|
||||||
ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
|
ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
|
||||||
@Override
|
@Override
|
||||||
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
|
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
|
||||||
|
@ -498,7 +498,7 @@ public class AuthorizationInterceptorR4Test {
|
||||||
httpPost.setEntity(createFhirResourceEntity(input));
|
httpPost.setEntity(createFhirResourceEntity(input));
|
||||||
status = ourClient.execute(httpPost);
|
status = ourClient.execute(httpPost);
|
||||||
extractResponseAndClose(status);
|
extractResponseAndClose(status);
|
||||||
assertEquals(403, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -95,6 +95,11 @@
|
||||||
When using the testpage overlay to delete a resource, currently a crash can occur
|
When using the testpage overlay to delete a resource, currently a crash can occur
|
||||||
if an unqualified ID is placed in the ID text box. This has been corrected.
|
if an unqualified ID is placed in the ID text box. This has been corrected.
|
||||||
</action>
|
</action>
|
||||||
|
<action type="fix">
|
||||||
|
AuthorizationInterceptor did not allow FHIR batch operations when the transaction()
|
||||||
|
permission is granted. This has been corrected so that transaction() allows both
|
||||||
|
batch and transaction requests to proceed.
|
||||||
|
</action>
|
||||||
</release>
|
</release>
|
||||||
|
|
||||||
<release version="3.5.0" date="2018-09-17">
|
<release version="3.5.0" date="2018-09-17">
|
||||||
|
|
Loading…
Reference in New Issue