mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fixing the user based policies
This commit is contained in:
parent
f7abe86e3c
commit
009c9dd6df
@ -63,13 +63,14 @@ public class PolicyFilterImpl implements PolicyFilter {
|
||||
@Override
|
||||
public void filterOwnershipTypeBasedPolicies(String ownershipType, List<Policy> policies) {
|
||||
|
||||
// List<Policy> temp = new ArrayList<Policy>();
|
||||
// for (Policy policy : policies) {
|
||||
// if (ownershipType.equalsIgnoreCase(policy.getOwnershipType())) {
|
||||
// temp.add(policy);
|
||||
// }
|
||||
// }
|
||||
// policies = temp;
|
||||
List<Policy> temp = new ArrayList<Policy>();
|
||||
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<String> users = policy.getUsers();
|
||||
if(users.contains(PolicyManagementConstants.ANY)) {
|
||||
temp.add(policy);
|
||||
continue;
|
||||
}
|
||||
for (String user : users) {
|
||||
if(usernames.contains(user)) {
|
||||
temp.add(policy);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user