|
|
@ -14,6 +14,23 @@
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
* under the License.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* Copyright (c) 2018, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
|
|
|
|
|
|
|
* Version 2.0 (the "License"); you may not use this file except
|
|
|
|
|
|
|
|
* in compliance with the License.
|
|
|
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -123,27 +140,27 @@ public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint {
|
|
|
|
public void reEnforcePolicy(DeviceIdentifier deviceIdentifier, NonComplianceData complianceData) throws
|
|
|
|
public void reEnforcePolicy(DeviceIdentifier deviceIdentifier, NonComplianceData complianceData) throws
|
|
|
|
PolicyComplianceException {
|
|
|
|
PolicyComplianceException {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// do not re-enforce policy if the only feature to be applied is enrollment app install
|
|
|
|
|
|
|
|
if (complianceData.getComplianceFeatures().size() != 1 || !PolicyManagementConstants
|
|
|
|
|
|
|
|
.ENROLLMENT_APP_INSTALL_FEATURE_CODE.equals(complianceData.getComplianceFeatures().get(0)
|
|
|
|
|
|
|
|
.getFeatureCode())) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Policy policy = complianceData.getPolicy();
|
|
|
|
Policy policy = complianceData.getPolicy();
|
|
|
|
if (policy != null) {
|
|
|
|
if (policy != null) {
|
|
|
|
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<DeviceIdentifier>();
|
|
|
|
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>();
|
|
|
|
deviceIdentifiers.add(deviceIdentifier);
|
|
|
|
deviceIdentifiers.add(deviceIdentifier);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ProfileOperation> profileOperationList = new ArrayList<>();
|
|
|
|
List<ProfileOperation> profileOperationList = new ArrayList<ProfileOperation>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PolicyOperation policyOperation = new PolicyOperation();
|
|
|
|
PolicyOperation policyOperation = new PolicyOperation();
|
|
|
|
policyOperation.setEnabled(true);
|
|
|
|
policyOperation.setEnabled(true);
|
|
|
|
policyOperation.setType(Operation.Type.POLICY);
|
|
|
|
policyOperation.setType(Operation.Type.POLICY);
|
|
|
|
policyOperation.setCode(PolicyOperation.POLICY_OPERATION_CODE);
|
|
|
|
policyOperation.setCode(PolicyOperation.POLICY_OPERATION_CODE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (complianceData.isCompletePolicy()) {
|
|
|
|
if (complianceData.isCompletePolicy()) {
|
|
|
|
List<ProfileFeature> effectiveFeatures = policy.getProfile().getProfileFeaturesList();
|
|
|
|
List<ProfileFeature> effectiveFeatures = policy.getProfile().getProfileFeaturesList();
|
|
|
|
|
|
|
|
|
|
|
|
for (ProfileFeature feature : effectiveFeatures) {
|
|
|
|
for (ProfileFeature feature : effectiveFeatures) {
|
|
|
|
ProfileOperation profileOperation = new ProfileOperation();
|
|
|
|
ProfileOperation profileOperation = new ProfileOperation();
|
|
|
|
|
|
|
|
|
|
|
|
profileOperation.setCode(feature.getFeatureCode());
|
|
|
|
profileOperation.setCode(feature.getFeatureCode());
|
|
|
|
profileOperation.setEnabled(true);
|
|
|
|
profileOperation.setEnabled(true);
|
|
|
|
profileOperation.setStatus(Operation.Status.PENDING);
|
|
|
|
profileOperation.setStatus(Operation.Status.PENDING);
|
|
|
@ -155,12 +172,9 @@ public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint {
|
|
|
|
List<ComplianceFeature> noneComplianceFeatures = complianceData.getComplianceFeatures();
|
|
|
|
List<ComplianceFeature> noneComplianceFeatures = complianceData.getComplianceFeatures();
|
|
|
|
List<ProfileFeature> effectiveFeatures = policy.getProfile().getProfileFeaturesList();
|
|
|
|
List<ProfileFeature> effectiveFeatures = policy.getProfile().getProfileFeaturesList();
|
|
|
|
for (ComplianceFeature feature : noneComplianceFeatures) {
|
|
|
|
for (ComplianceFeature feature : noneComplianceFeatures) {
|
|
|
|
|
|
|
|
|
|
|
|
for (ProfileFeature pf : effectiveFeatures) {
|
|
|
|
for (ProfileFeature pf : effectiveFeatures) {
|
|
|
|
if (pf.getFeatureCode().equalsIgnoreCase(feature.getFeatureCode())) {
|
|
|
|
if (pf.getFeatureCode().equalsIgnoreCase(feature.getFeatureCode())) {
|
|
|
|
|
|
|
|
|
|
|
|
ProfileOperation profileOperation = new ProfileOperation();
|
|
|
|
ProfileOperation profileOperation = new ProfileOperation();
|
|
|
|
|
|
|
|
|
|
|
|
profileOperation.setCode(feature.getFeatureCode());
|
|
|
|
profileOperation.setCode(feature.getFeatureCode());
|
|
|
|
profileOperation.setEnabled(true);
|
|
|
|
profileOperation.setEnabled(true);
|
|
|
|
profileOperation.setStatus(Operation.Status.PENDING);
|
|
|
|
profileOperation.setStatus(Operation.Status.PENDING);
|
|
|
@ -190,6 +204,7 @@ public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint {
|
|
|
|
deviceIdentifier.getType(), e);
|
|
|
|
deviceIdentifier.getType(), e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void markDeviceAsNoneCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
|
|
|
public void markDeviceAsNoneCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
|
|
|