|
|
|
@ -33,13 +33,14 @@ public class PolicyFilterImpl implements PolicyFilter {
|
|
|
|
|
private static final Log log = LogFactory.getLog(PolicyFilterImpl.class);
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void filterRolesBasedPolicies(String roles[], List<Policy> policies) {
|
|
|
|
|
public List<Policy> filterRolesBasedPolicies(String roles[], List<Policy> policies) {
|
|
|
|
|
|
|
|
|
|
List<Policy> temp = new ArrayList<Policy>();
|
|
|
|
|
for (Policy policy : policies) {
|
|
|
|
|
|
|
|
|
|
List<String> tempRoles = policy.getRoles();
|
|
|
|
|
if (tempRoles.isEmpty()) {
|
|
|
|
|
temp.add(policy);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (PolicyManagementConstants.ANY.equalsIgnoreCase(tempRoles.get(0))) {
|
|
|
|
@ -56,12 +57,11 @@ public class PolicyFilterImpl implements PolicyFilter {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
policies = temp;
|
|
|
|
|
|
|
|
|
|
return temp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void filterOwnershipTypeBasedPolicies(String ownershipType, List<Policy> policies) {
|
|
|
|
|
public List<Policy> filterOwnershipTypeBasedPolicies(String ownershipType, List<Policy> policies) {
|
|
|
|
|
|
|
|
|
|
List<Policy> temp = new ArrayList<Policy>();
|
|
|
|
|
for (Policy policy : policies) {
|
|
|
|
@ -70,22 +70,22 @@ public class PolicyFilterImpl implements PolicyFilter {
|
|
|
|
|
temp.add(policy);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
policies = temp;
|
|
|
|
|
return temp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void filterDeviceTypeBasedPolicies(String deviceType, List<Policy> policies) {
|
|
|
|
|
public List<Policy> filterDeviceTypeBasedPolicies(String deviceType, List<Policy> policies) {
|
|
|
|
|
List<Policy> temp = new ArrayList<Policy>();
|
|
|
|
|
for (Policy policy : policies) {
|
|
|
|
|
if (deviceType.equalsIgnoreCase(policy.getProfile().getDeviceType().getName())) {
|
|
|
|
|
temp.add(policy);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
policies = temp;
|
|
|
|
|
return temp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void filterUserBasedPolicies(List<String> usernames, List<Policy> policies) {
|
|
|
|
|
public List<Policy> filterUserBasedPolicies(String username, List<Policy> policies) {
|
|
|
|
|
List<Policy> temp = new ArrayList<Policy>();
|
|
|
|
|
|
|
|
|
|
for (Policy policy : policies) {
|
|
|
|
@ -95,13 +95,11 @@ public class PolicyFilterImpl implements PolicyFilter {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (String user : users) {
|
|
|
|
|
if(usernames.contains(user)) {
|
|
|
|
|
if(username.equalsIgnoreCase(user)) {
|
|
|
|
|
temp.add(policy);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
policies = temp;
|
|
|
|
|
return temp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|