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