Fixing the user based policies

4.x.x
geethkokila 10 years ago
parent f7abe86e3c
commit 009c9dd6df

@ -63,13 +63,14 @@ public class PolicyFilterImpl implements PolicyFilter {
@Override @Override
public void filterOwnershipTypeBasedPolicies(String ownershipType, List<Policy> policies) { public void filterOwnershipTypeBasedPolicies(String ownershipType, List<Policy> policies) {
// List<Policy> temp = new ArrayList<Policy>(); List<Policy> temp = new ArrayList<Policy>();
// for (Policy policy : policies) { for (Policy policy : policies) {
// if (ownershipType.equalsIgnoreCase(policy.getOwnershipType())) { if (ownershipType.equalsIgnoreCase(policy.getOwnershipType()) ||
// temp.add(policy); PolicyManagementConstants.ANY.equalsIgnoreCase(policy.getOwnershipType())) {
// } temp.add(policy);
// } }
// policies = temp; }
policies = temp;
} }
@Override @Override
@ -89,6 +90,10 @@ public class PolicyFilterImpl implements PolicyFilter {
for (Policy policy : policies) { for (Policy policy : policies) {
List<String> users = policy.getUsers(); List<String> users = policy.getUsers();
if(users.contains(PolicyManagementConstants.ANY)) {
temp.add(policy);
continue;
}
for (String user : users) { for (String user : users) {
if(usernames.contains(user)) { if(usernames.contains(user)) {
temp.add(policy); temp.add(policy);

Loading…
Cancel
Save