fixing windows10 policy issue

revert-dabc3590
Hasunie 8 years ago
parent 3b7257c93f
commit 399496ce82

@ -114,15 +114,16 @@ public class OperationCode {
CAMERA_STATUS("./Vendor/MSFT/PolicyManager/Device/Camera/AllowCamera"),
ENCRYPT_STORAGE("./Vendor/MSFT/PolicyManager/My/Security/RequireDeviceEncryption"),
ENCRYPT_STORAGE_STATUS("./Vendor/MSFT/PolicyManager/Device/Security/RequireDeviceEncryption"),
PASSWORD_MAX_FAIL_ATTEMPTS("./Vendor/MSFT/PolicyManager/My/DeviceLock/MaxDevicePasswordFailedAttempts"),
DEVICE_PASSWORD_ENABLE("./Vendor/MSFT/PolicyManager/My/DeviceLock/DevicePasswordEnabled"),
SIMPLE_PASSWORD("./Vendor/MSFT/PolicyManager/My/DeviceLock/AllowSimpleDevicePassword"),
MIN_PASSWORD_LENGTH("./Vendor/MSFT/PolicyManager/My/DeviceLock/MinDevicePasswordLength"),
Alphanumeric_PASSWORD("./Vendor/MSFT/PolicyManager/My/DeviceLock/AlphanumericDevicePasswordRequired"),
PASSWORD_EXPIRE("./Vendor/MSFT/PolicyManager/My/DeviceLock/DevicePasswordExpiration"),
PASSWORD_HISTORY("./Vendor/MSFT/PolicyManager/My/DeviceLock/DevicePasswordHistory"),
MAX_PASSWORD_INACTIVE_TIME("./Vendor/MSFT/PolicyManager/My/DeviceLock/MaxInactivityTimeDeviceLock"),
MIN_PASSWORD_COMPLEX_CHARACTERS("./Vendor/MSFT/PolicyManager/My/DeviceLock/MinDevicePasswordComplexCharacters");
PASSWORD_MAX_FAIL_ATTEMPTS("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/MaxDevicePasswordFailedAttempts"),
DEVICE_PASSWORD_ENABLE("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/DevicePasswordEnabled"),
SIMPLE_PASSWORD("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/AllowSimpleDevicePassword"),
MIN_PASSWORD_LENGTH("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/MinDevicePasswordLength"),
ALPHANUMERIC_PASSWORD("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/AlphanumericDevicePasswordRequired"),
PASSWORD_EXPIRE("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/DevicePasswordExpiration"),
PASSWORD_HISTORY("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/DevicePasswordHistory"),
MAX_PASSWORD_INACTIVE_TIME("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/MaxInactivityTimeDeviceLock"),
MIN_PASSWORD_COMPLEX_CHARACTERS("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/MinDevicePasswordComplexCharacters");
private final String code;

@ -316,7 +316,9 @@ public class OperationReply {
if (this.syncmlDocument.getBody().getAlert() != null) {
if (Constants.INITIAL_ALERT_DATA.equals(this.syncmlDocument.getBody().
getAlert().getData())) {
getAlert().getData()) || Constants.INITIAL_WIN10_ALERT_DATA.
equals(this.syncmlDocument.getBody()
.getAlert().getData())) {
monitorSequence.setCommandId(operation.getId());
DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(
@ -740,45 +742,105 @@ public class OperationReply {
}
public AddTag generatePasscodeBooleanData(Operation operation, Configure configure) {
TargetTag target = new TargetTag();
MetaTag meta = new MetaTag();
AddTag addTag = null;
PasscodePolicy passcodePolicy = gson.fromJson((String) operation.getPayLoad(), PasscodePolicy.class);
if (operation.getCode() != null && (PluginConstants.OperationCodes.DEVICE_PASSWORD_ENABLE.
equals(configure.name()))) {
if (passcodePolicy.isEnablePassword()) {
target.setLocURI(configure.getCode());
meta.setFormat(Constants.META_FORMAT_INT);
addTag = TagUtil.buildAddTag(operation, Constants.SyncMLResponseCodes.NEGATIVE_CSP_DATA);
addTag = new AddTag();
List<ItemTag> itemList = new ArrayList<>();
ItemTag item = new ItemTag();
TargetTag targetTag = new TargetTag();
targetTag.setLocURI(configure.getCode());
MetaTag metaag = new MetaTag();
metaag.setFormat(Constants.META_FORMAT_INT);
item.setTarget(targetTag);
item.setMeta(metaag);
item.setData(Constants.SyncMLResponseCodes.NEGATIVE_CSP_DATA);
itemList.add(item);
addTag.setCommandId(Constants.SyncmlMessageCodes.addCommandId);
addTag.setItems(itemList);
} else {
target.setLocURI(configure.getCode());
meta.setFormat(Constants.META_FORMAT_INT);
addTag = TagUtil.buildAddTag(operation, Constants.SyncMLResponseCodes.POSITIVE_CSP_DATA);
addTag = new AddTag();
List<ItemTag> itemList = new ArrayList<>();
ItemTag item = new ItemTag();
TargetTag targetTag = new TargetTag();
targetTag.setLocURI(configure.getCode());
MetaTag metaag = new MetaTag();
metaag.setFormat(Constants.META_FORMAT_INT);
item.setTarget(targetTag);
item.setMeta(metaag);
item.setData(Constants.SyncMLResponseCodes.POSITIVE_CSP_DATA);
itemList.add(item);
addTag.setCommandId(Constants.SyncmlMessageCodes.addCommandId);
addTag.setItems(itemList);
}
}
if (PluginConstants.OperationCodes.ALPHANUMERIC_PASSWORD.
equals(configure.name())) {
if (passcodePolicy.isRequireAlphanumeric()) {
target.setLocURI(configure.getCode());
meta.setFormat(Constants.META_FORMAT_INT);
addTag = TagUtil.buildAddTag(operation, Constants.SyncMLResponseCodes.POSITIVE_CSP_DATA);
addTag = new AddTag();
List<ItemTag> itemList = new ArrayList<>();
ItemTag item = new ItemTag();
TargetTag targetTag = new TargetTag();
targetTag.setLocURI(configure.getCode());
MetaTag metaag = new MetaTag();
metaag.setFormat(Constants.META_FORMAT_INT);
item.setTarget(targetTag);
item.setMeta(metaag);
item.setData(Constants.SyncMLResponseCodes.POSITIVE_CSP_DATA);
itemList.add(item);
addTag.setCommandId(Constants.SyncmlMessageCodes.addCommandId);
addTag.setItems(itemList);
} else {
target.setLocURI(configure.getCode());
meta.setFormat(Constants.META_FORMAT_INT);
addTag = TagUtil.buildAddTag(operation, Constants.SyncMLResponseCodes.NEGATIVE_CSP_DATA);
addTag = new AddTag();
List<ItemTag> itemList = new ArrayList<>();
ItemTag item = new ItemTag();
TargetTag targetTag = new TargetTag();
targetTag.setLocURI(configure.getCode());
MetaTag metaag = new MetaTag();
metaag.setFormat(Constants.META_FORMAT_INT);
item.setTarget(targetTag);
item.setMeta(metaag);
item.setData(Constants.SyncMLResponseCodes.NEGATIVE_CSP_DATA);
itemList.add(item);
addTag.setCommandId(Constants.SyncmlMessageCodes.addCommandId);
addTag.setItems(itemList);
}
}
if (PluginConstants.OperationCodes.SIMPLE_PASSWORD.
equals(configure.name())) {
if (passcodePolicy.isAllowSimple()) {
target.setLocURI(configure.getCode());
meta.setFormat(Constants.META_FORMAT_INT);
addTag = TagUtil.buildAddTag(operation, Constants.SyncMLResponseCodes.POSITIVE_CSP_DATA);
addTag = new AddTag();
List<ItemTag> itemList = new ArrayList<>();
ItemTag item = new ItemTag();
TargetTag targetTag = new TargetTag();
targetTag.setLocURI(configure.getCode());
MetaTag metaag = new MetaTag();
metaag.setFormat(Constants.META_FORMAT_INT);
item.setTarget(targetTag);
item.setMeta(metaag);
item.setData(Constants.SyncMLResponseCodes.POSITIVE_CSP_DATA);
itemList.add(item);
addTag.setCommandId(Constants.SyncmlMessageCodes.addCommandId);
addTag.setItems(itemList);
} else {
target.setLocURI(configure.getCode());
meta.setFormat(Constants.META_FORMAT_INT);
addTag = TagUtil.buildAddTag(operation, Constants.SyncMLResponseCodes.NEGATIVE_CSP_DATA);
addTag = new AddTag();
List<ItemTag> itemList = new ArrayList<>();
ItemTag item = new ItemTag();
TargetTag targetTag = new TargetTag();
targetTag.setLocURI(configure.getCode());
MetaTag metaag = new MetaTag();
metaag.setFormat(Constants.META_FORMAT_INT);
item.setTarget(targetTag);
item.setMeta(metaag);
item.setData(Constants.SyncMLResponseCodes.NEGATIVE_CSP_DATA);
itemList.add(item);
addTag.setCommandId(Constants.SyncmlMessageCodes.addCommandId);
addTag.setItems(itemList);
}
}
return addTag;

@ -1,56 +0,0 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.
*/
package org.wso2.carbon.device.mgt.mobile.windows.api.operations.util;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.AddTag;
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.ItemTag;
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.MetaTag;
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.TargetTag;
import java.util.ArrayList;
import java.util.List;
/**
* Contains utility methods which are used while creating Syncml Messages.
*/
public class TagUtil {
/**
* Build syncml AddTag for Device response message.
*
* @param operation Policy operation
* @param data Configuration service provider(CSP) data value 1/0
* @return Syncml AddTag type object.
*/
public static AddTag buildAddTag(Operation operation, String data) {
TargetTag target = new TargetTag();
MetaTag meta = new MetaTag();
AddTag add = new AddTag();
List<ItemTag> itemTags = new ArrayList<>();
ItemTag itemTag = new ItemTag();
itemTag.setTarget(target);
itemTag.setMeta(meta);
itemTag.setData(data);
itemTags.add(itemTag);
add.setCommandId(operation.getId());
add.setItems(itemTags);
return add;
}
}
Loading…
Cancel
Save