From 036ed6fe4161b7b9cb9562831829a813b295ab55 Mon Sep 17 00:00:00 2001 From: harshanl Date: Fri, 14 Oct 2016 19:20:11 +0530 Subject: [PATCH] Added POLICY_REVOKE operation upon deletion of the last policy --- .../core/enforcement/PolicyEnforcementDelegatorImpl.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java index 304482f1366..2fa70bb3af6 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java @@ -68,12 +68,14 @@ public class PolicyEnforcementDelegatorImpl implements PolicyEnforcementDelegato identifier.setType(device.getType()); Policy policy = this.getEffectivePolicy(identifier); - + List deviceIdentifiers = new ArrayList<>(); + deviceIdentifiers.add(identifier); if (policy != null) { - List deviceIdentifiers = new ArrayList<>(); - deviceIdentifiers.add(identifier); this.addPolicyRevokeOperation(deviceIdentifiers); this.addPolicyOperation(deviceIdentifiers, policy); + } else { + //This means all the applicable policies have been removed from device. Hence calling a policy revoke. + this.addPolicyRevokeOperation(deviceIdentifiers); } } }