From 009c9dd6df15d00b6cda37b83ff7adf937cf3b77 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Mon, 1 Jun 2015 12:05:12 -0400 Subject: [PATCH] Fixing the user based policies --- .../mgt/core/impl/PolicyFilterImpl.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyFilterImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyFilterImpl.java index 391d5e4b7d..0927bfc64b 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyFilterImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyFilterImpl.java @@ -63,13 +63,14 @@ public class PolicyFilterImpl implements PolicyFilter { @Override public void filterOwnershipTypeBasedPolicies(String ownershipType, List policies) { -// List temp = new ArrayList(); -// for (Policy policy : policies) { -// if (ownershipType.equalsIgnoreCase(policy.getOwnershipType())) { -// temp.add(policy); -// } -// } -// policies = temp; + List temp = new ArrayList(); + for (Policy policy : policies) { + if (ownershipType.equalsIgnoreCase(policy.getOwnershipType()) || + PolicyManagementConstants.ANY.equalsIgnoreCase(policy.getOwnershipType())) { + temp.add(policy); + } + } + policies = temp; } @Override @@ -89,6 +90,10 @@ public class PolicyFilterImpl implements PolicyFilter { for (Policy policy : policies) { List users = policy.getUsers(); + if(users.contains(PolicyManagementConstants.ANY)) { + temp.add(policy); + continue; + } for (String user : users) { if(usernames.contains(user)) { temp.add(policy);