|
|
|
@ -14,6 +14,23 @@
|
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
|
* 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
|
|
|
|
|
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 {
|
|
|
|
|
Policy policy = complianceData.getPolicy();
|
|
|
|
|
if (policy != null) {
|
|
|
|
|
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<DeviceIdentifier>();
|
|
|
|
|
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>();
|
|
|
|
|
deviceIdentifiers.add(deviceIdentifier);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ProfileOperation> profileOperationList = new ArrayList<ProfileOperation>();
|
|
|
|
|
List<ProfileOperation> profileOperationList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
PolicyOperation policyOperation = new PolicyOperation();
|
|
|
|
|
policyOperation.setEnabled(true);
|
|
|
|
|
policyOperation.setType(Operation.Type.POLICY);
|
|
|
|
|
policyOperation.setCode(PolicyOperation.POLICY_OPERATION_CODE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (complianceData.isCompletePolicy()) {
|
|
|
|
|
List<ProfileFeature> effectiveFeatures = policy.getProfile().getProfileFeaturesList();
|
|
|
|
|
|
|
|
|
|
for (ProfileFeature feature : effectiveFeatures) {
|
|
|
|
|
ProfileOperation profileOperation = new ProfileOperation();
|
|
|
|
|
|
|
|
|
|
profileOperation.setCode(feature.getFeatureCode());
|
|
|
|
|
profileOperation.setEnabled(true);
|
|
|
|
|
profileOperation.setStatus(Operation.Status.PENDING);
|
|
|
|
@ -155,12 +172,9 @@ public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint {
|
|
|
|
|
List<ComplianceFeature> noneComplianceFeatures = complianceData.getComplianceFeatures();
|
|
|
|
|
List<ProfileFeature> effectiveFeatures = policy.getProfile().getProfileFeaturesList();
|
|
|
|
|
for (ComplianceFeature feature : noneComplianceFeatures) {
|
|
|
|
|
|
|
|
|
|
for (ProfileFeature pf : effectiveFeatures) {
|
|
|
|
|
if (pf.getFeatureCode().equalsIgnoreCase(feature.getFeatureCode())) {
|
|
|
|
|
|
|
|
|
|
ProfileOperation profileOperation = new ProfileOperation();
|
|
|
|
|
|
|
|
|
|
profileOperation.setCode(feature.getFeatureCode());
|
|
|
|
|
profileOperation.setEnabled(true);
|
|
|
|
|
profileOperation.setStatus(Operation.Status.PENDING);
|
|
|
|
@ -190,6 +204,7 @@ public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint {
|
|
|
|
|
deviceIdentifier.getType(), e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void markDeviceAsNoneCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
|
|
|
|