Merge branch 'newpolicy' into 'master'

Create the display-message-configuration policy

## Purpose
Need to display a message on the lock screen when the device owner is enabled, Need to display a message on the device administrators apps and the disabled settings

## Goals
Need to create a policy to show those messages on the devices

## Approach
Create a policy to show those messages on the device

## Screenshots

![Screenshot_from_2019-11-03_15-13-34](/uploads/2864b93e78a88f3f3d895e55450eeab5/Screenshot_from_2019-11-03_15-13-34.png)

![Screenshot_from_2019-11-05_00-32-45](/uploads/26238a9da284ea621db232e2147b8e56/Screenshot_from_2019-11-05_00-32-45.png)

![Screenshot_20191105-003837_Settings](/uploads/54003b98cd443152f3131d33d71d2669/Screenshot_20191105-003837_Settings.jpg)

![Screenshot_20191105-003848_Settings](/uploads/b185c1ae37b3035af0857848bc8e6f9b/Screenshot_20191105-003848_Settings.jpg)

![Screenshot_20191105-003823_Entgra_Device_Management_Agent](/uploads/b4678d3ec70609d74f107538884f5656/Screenshot_20191105-003823_Entgra_Device_Management_Agent.jpg)

![Screenshot_20191105-112022_Settings](/uploads/5f7e39e0272ea4e3e64929573df45afe/Screenshot_20191105-112022_Settings.jpg)

## Documentation
Android Developer  

https://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#setDeviceOwnerLockScreenInfo(android.content.ComponentName,%20java.lang.CharSequence)  

https://developer.android.com/reference/android/app/admin/DevicePolicyManager#setLongSupportMessage(android.content.ComponentName,%20java.lang.CharSequence)  

https://developer.android.com/reference/android/app/admin/DevicePolicyManager#setShortSupportMessage(android.content.ComponentName,%20java.lang.CharSequence)

## Automation tests
 - Unit tests 
   N/A
 - Integration tests
   N/A

## Security checks
 - Followed secure coding standards? (yes)
 - Ran FindSecurityBugs plugin and verified report? (no)
 - Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? (yes)

## Related MRs
N/A

## Test environment
Ubuntu 18.04

## Learning
N/A

See merge request entgra/carbon-device-mgt-plugins!109
revert-dabc3590
Saad Sahibjan 5 years ago
commit c5c4e0a5b9

@ -0,0 +1,65 @@
/*
* Copyright (c) 2019, 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.
*/
package org.wso2.carbon.mdm.services.android.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* This class represents the information of configuring display message operation.
*/
@ApiModel(value = "LockScreenMessage", description = "This class represents the information of configuring wifi operation")
public class DisplayMessage extends AndroidOperation implements Serializable {
@ApiModelProperty(name = "lockScreenMessage", value = "The message of the lock screen that you wish to configure",
required = true)
private String lockScreenMessage;
@ApiModelProperty(name = "settingAppSupportMessage", value = "The message of the administrators applications that you wish to configure",
required = true)
private String settingAppSupportMessage;
@ApiModelProperty(name = "disabledSettingSupportMessage", value = "The password to connect to the specified Wifi network",
required = true)
private String disabledSettingSupportMessage;
public String getLockScreenMessage() {
return lockScreenMessage;
}
public void setLockScreenMessage(String lockScreenMessage) {
this.lockScreenMessage = lockScreenMessage;
}
public String getSettingAppSupportMessage() {
return settingAppSupportMessage;
}
public void setSettingAppSupportMessage(String settingAppSupportMessage) {
this.settingAppSupportMessage = settingAppSupportMessage;
}
public String getDisabledSettingSupportMessage() {
return disabledSettingSupportMessage;
}
public void setDisabledSettingSupportMessage(String disabledSettingSupportMessage) {
this.disabledSettingSupportMessage = disabledSettingSupportMessage;
}
}

@ -0,0 +1,54 @@
/*
* Copyright (c) 2019, 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.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.DisplayMessage;
import java.util.List;
/**
* This class is used to wrap the Wifi bean with devices.
*/
@ApiModel(value = "DisplayMessageBeanWrapper",
description = "Mapping between display message operation and device list to be applied.")
public class DisplayMessageBeanWrapper {
@ApiModelProperty(name = "operation", value = "Information of configuring display message operation", required = true)
private DisplayMessage operation;
@ApiModelProperty(name = "deviceIDs", value = "List of device Ids", required = true)
private List<String> deviceIDs;
public DisplayMessage getOperation() {
return operation;
}
public void setOperation(DisplayMessage operation) {
this.operation = operation;
}
public List<String> getDeviceIDs() {
return deviceIDs;
}
public void setDeviceIDs(List<String> deviceIDs) {
this.deviceIDs = deviceIDs;
}
}

@ -257,6 +257,12 @@ import java.util.List;
description = "Send app restrictions to an application in the device",
key = "perm:android:send-app-restrictions",
permissions = {"/device-mgt/devices/owning-device/operations/android/send-app-conf"}
),
@Scope(
name = "Configure display message",
description = "Configure display message on Android Device",
key = "perm:android:configure-display-message",
permissions = {"/device-mgt/devices/owning-device/operations/android/display-message"}
)
}
)
@ -2052,4 +2058,55 @@ public interface DeviceManagementAdminService {
value = "The properties to set the global proxy settings.",
required = true)
GlobalProxyBeanWrapper globalProxyBeanWrapper);
@POST
@Path("/configure-display-message")
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Sending a messages to Android Devices.",
notes = "Send a message to Android Devices.",
response = Activity.class,
tags = "Android Device Management Administrative Service",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:configure-display-message")
})
}
)
@ApiResponses(value = {
@ApiResponse(
code = 201,
message = "Created. \n Successfully sent the message.",
response = Activity.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "URL of the activity instance that refers to the scheduled operation."),
@ResponseHeader(
name = "Content-Type",
description = "Content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while adding a new display messages operation.")
})
Response configureDisplayMessage(
@ApiParam(
name = "display-message",
value = "The properties required to send a messages. Provide the message you wish to send and the ID of the " +
"Android device. Multiple device IDs can be added by using comma separated values.",
required = true)
DisplayMessageBeanWrapper displayMessageBeanWrapper);
}

@ -37,6 +37,7 @@ package org.wso2.carbon.mdm.services.android.services.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpStatus;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
@ -56,6 +57,7 @@ import org.wso2.carbon.mdm.services.android.bean.ErrorResponse;
import org.wso2.carbon.mdm.services.android.bean.FileTransfer;
import org.wso2.carbon.mdm.services.android.bean.GlobalProxy;
import org.wso2.carbon.mdm.services.android.bean.LockCode;
import org.wso2.carbon.mdm.services.android.bean.DisplayMessage;
import org.wso2.carbon.mdm.services.android.bean.Notification;
import org.wso2.carbon.mdm.services.android.bean.PasscodePolicy;
import org.wso2.carbon.mdm.services.android.bean.UpgradeFirmware;
@ -74,6 +76,7 @@ import org.wso2.carbon.mdm.services.android.bean.wrapper.EncryptionBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.FileTransferBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.GlobalProxyBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.LockCodeBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.DisplayMessageBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.NotificationBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.PasswordPolicyBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.UpgradeFirmwareBeanWrapper;
@ -1090,6 +1093,47 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
}
}
@POST
@Path("/configure-display-message")
@Override
public Response configureDisplayMessage(DisplayMessageBeanWrapper displayMessageBeanWrapper) {
if (log.isDebugEnabled()) {
log.debug("Invoking 'configure-display-message' operation");
}
try {
if (displayMessageBeanWrapper == null || displayMessageBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the display message operation is incorrect";
log.error(errorMessage);
throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_BAD_REQUEST).
setMessage(errorMessage).build());
}
DisplayMessage configureDisplayMessage = displayMessageBeanWrapper.getOperation();
ProfileOperation operation = new ProfileOperation();
operation.setCode(AndroidConstants.OperationCodes.DISPLAY_MESSAGE_CONFIGURATION);
operation.setType(Operation.Type.PROFILE);
operation.setPayLoad(configureDisplayMessage.toJSON());
Activity activity = AndroidDeviceUtils.getOperationResponse(displayMessageBeanWrapper.
getDeviceIDs(), operation);
return Response.status(Response.Status.CREATED).entity(activity).build();
} catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e);
throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_BAD_REQUEST).
setMessage(errorMessage).build());
} catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance";
log.error(errorMessage, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().
setCode(HttpStatus.SC_INTERNAL_SERVER_ERROR).setMessage(errorMessage).build());
}
}
private static void validateApplicationUrl(String apkUrl) {
try {
URL url = new URL(apkUrl);

@ -151,6 +151,7 @@ public final class AndroidConstants {
public static final String NOTIFIER_FREQUENCY = "NOTIFIER_FREQUENCY";
public static final String GLOBAL_PROXY = "SET_GLOBAL_PROXY";
public static final String REMOTE_APP_CONFIG = "REMOTE_APP_CONFIG";
public static final String DISPLAY_MESSAGE_CONFIGURATION = "DISPLAY_MESSAGE_CONFIGURATION";
}
public final class StatusCodes {

@ -110,7 +110,8 @@ var androidOperationModule = function () {
"DISALLOW_BLUETOOTH_SHARING": "DISALLOW_BLUETOOTH_SHARING",
"DISALLOW_REMOVE_USER": "DISALLOW_REMOVE_USER",
"DISALLOW_DATA_ROAMING": "DISALLOW_DATA_ROAMING",
"CERT_ADD_OPERATION_CODE": "INSTALL_CERT"
"CERT_ADD_OPERATION_CODE": "INSTALL_CERT",
"DISPLAY_MESSAGE_CONFIGURATION_OPERATION_CODE": "DISPLAY_MESSAGE_CONFIGURATION"
};
/**
@ -333,6 +334,13 @@ var androidOperationModule = function () {
"CERT_LIST": listNew
};
break;
case androidOperationConstants["DISPLAY_MESSAGE_CONFIGURATION_OPERATION_CODE"]:
payload = {
"lockScreenMessage": operationPayload["lockScreenMessage"],
"settingAppSupportMessage": operationPayload["settingAppSupportMessage"],
"disabledSettingSupportMessage": operationPayload["disabledSettingSupportMessage"]
};
break;
}
return payload;
};
@ -717,6 +725,16 @@ var androidOperationModule = function () {
}
};
break;
case androidOperationConstants["DISPLAY_MESSAGE_CONFIGURATION_OPERATION_CODE"]:
operationType = operationTypeConstants["PROFILE"];
payload = {
"operation": {
"lockScreenMessage": operationData["lockScreenMessage"],
"settingAppSupportMessage": operationData["settingAppSupportMessage"],
"disabledSettingSupportMessage": operationData["disabledSettingSupportMessage"]
}
};
break;
default:
// If the operation is neither of above, it is a command operation
operationType = operationTypeConstants["COMMAND"];
@ -757,7 +775,8 @@ var androidOperationModule = function () {
"BLACKLIST_APPLICATIONS": "blacklist-applications",
"PASSCODE_POLICY": "set-password-policy",
"ENTERPRISE_WIPE": "enterprise-wipe",
"WIPE_DATA": "wipe"
"WIPE_DATA": "wipe",
"DISPLAY_MESSAGE_CONFIGURATION": "configure-display-message"
};
return "/api/device-mgt/android/v1.0/admin/devices/" + featureMap[operationCode];
};

@ -59,7 +59,9 @@ var androidOperationConstants = {
"COSU_PROFILE_CONFIGURATION_OPERATION_CODE": "COSU_PROFILE",
"ENROLLMENT_APP_INSTALL": "enrollment-app-install",
"ENROLLMENT_APP_INSTALL_CODE": "ENROLLMENT_APP_INSTALL",
"CERT_ADD_OPERATION_CODE": "INSTALL_CERT"
"CERT_ADD_OPERATION_CODE": "INSTALL_CERT",
"DISPLAY_MESSAGE_CONFIGURATION_OPERATION": "display-message-configuration",
"DISPLAY_MESSAGE_CONFIGURATION_OPERATION_CODE": "DISPLAY_MESSAGE_CONFIGURATION"
};
/**
@ -662,6 +664,37 @@ var validatePolicyProfile = function () {
validationStatusArray.push(validationStatus);
}
// Validating DISPLAY MESSAGE CONFIGURATION
if ($.inArray(androidOperationConstants["DISPLAY_MESSAGE_CONFIGURATION_OPERATION_CODE"], configuredOperations) != -1) {
// if DISPLAY_MESSAGE_CONFIGURATION policy is configured
operation = androidOperationConstants["DISPLAY_MESSAGE_CONFIGURATION_OPERATION"];
// initializing continueToCheckNextInputs to true
continueToCheckNextInputs = true;
var lockScreenMessage = $("textarea#lock-screen-message").val();
var settingAppMessage = $("textarea#setting-app-message").val();
var disabledSettingMessage = $("textarea#disabled-setting-message").val();
if (!lockScreenMessage && !settingAppMessage && !disabledSettingMessage) {
validationStatus = {
"error": true,
"subErrorMsg": "Please fill at-least a one field.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
}
// at-last, if the value of continueToCheckNextInputs is still true
// this means that no error is found
if (continueToCheckNextInputs) {
validationStatus = {
"error": false,
"okFeature": operation
};
}
// updating validationStatusArray with validationStatus
validationStatusArray.push(validationStatus);
}
// Validating PROXY
if ($.inArray(androidOperationConstants["GLOBAL_PROXY_OPERATION_CODE"], configuredOperations) !== -1) {
// if PROXY is configured

@ -162,6 +162,18 @@
<span id="enrollment-app-install-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="enrollment-app-install-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<a href="javascript:void(0)" class="display-message-configuration" onclick="showAdvanceOperation('display-message-configuration', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-comment fw-stack-2x"></i>
</span>
Display Message Configuration
<span id="display-message-configuration-configured" class="has-configured status-icon hidden"><i
class="fw fw-success"></i></span>
<span id="display-message-configuration-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="display-message-configuration-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
</div>
<div class="wr-hidden-operations-content col-lg-8">
@ -3318,6 +3330,78 @@
</div>
</div>
<!--/enrolment-app-install-->
<!--Display Message Configuration-->
<div class="wr-hidden-operation" data-operation="display-message-configuration">
<div class="panel panel-default operation-data" data-operation="display-message-configuration" data-operation-code="DISPLAY_MESSAGE_CONFIGURATION">
<div id="display-message-configuration-policy-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Display Message Configuration
<label id="display-message-configuration-policy-lbl" class="wr-input-control switch" data-toggle="collapse"
data-target="#display-message-configuration-policy-body">
<input type="checkbox"/>
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
<div class="panel-title-description">
Configure these settings to manage the applications in the show message.
</div>
</div>
<div id="display-message-configuration-policy-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="display-message-configuration-policy-body">
<hr/>
<br>
<div id="display-message-configuration-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="lock-screen-message-policy-enable-system-apps">
Lock Screen Message
<span class="helper"
title="The message that needs to show on the lock-screen.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
</label>
<br>
<a id="policy-listing-status-msg"> Below lock screen message is valid only when the Agent is the
<b>device owner</b>.</a>
<br>
<textarea id="lock-screen-message" type="text"
class="form-control operationDataKeys" rows="4"
data-key="lockScreenMessage"></textarea>
<br><br>
<label class="wr-input-label" for="setting-app-support-message-policy-enable-system-apps">
Setting App Support Message
<span class="helper"
title="The message that needs to show on the device administrators apps.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
</label>
<textarea id="setting-app-message" type="text"
class="form-control operationDataKeys" rows="4"
data-key="settingAppSupportMessage"></textarea>
<br><br>
<label class="wr-input-label" for="disabled-setting-app-support-message-policy-enable-system-apps">
Disabled Setting Support Message
<span class="helper"
title="The message that needs to show on the screens where funtionality has been disabled by the admin.Max length is 200">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
</label>
<textarea id="disabled-setting-message" type="text"
class="form-control operationDataKeys" rows="4"
data-key="disabledSettingSupportMessage"
maxlength="200"></textarea>
</div>
</div>
</div>
</div>
<!--/Display Message Configuration-->
</div>
<script type="text/javascript">applyDataTable();</script>
</div>

@ -144,6 +144,18 @@
<span id="enrollment-app-install-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="enrollment-app-install-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<a href="javascript:void(0)" class="display-message-configuration" onclick="showAdvanceOperation('display-message-configuration', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-comment fw-stack-2x"></i>
</span>
Display Message Configuration
<span id="display-message-configuration-configured" class="has-configured status-icon hidden"><i
class="fw fw-success"></i></span>
<span id="display-message-configuration-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="display-message-configuration-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
</div>
<div class="wr-hidden-operations-content col-lg-8">
<!-- passcode-policy -->
@ -3235,6 +3247,74 @@
</div>
</div>
<!--/enrolment-app-install-->
<!--Display Message Configuration-->
<div class="wr-hidden-operation" data-operation="display-message-configuration">
<div class="panel panel-default operation-data" data-operation="display-message-configuration" data-operation-code="DISPLAY_MESSAGE_CONFIGURATION">
<div id="display-message-configuration-policy-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Display Message Configuration
<label id="display-message-configuration-policy-lbl" class="wr-input-control switch hidden" data-toggle="collapse"
data-target="#display-message-configuration-policy-body">
<input type="checkbox"/>
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
<div class="panel-title-description">
Configure these settings to manage the applications in the show message.
</div>
</div>
<div id="display-message-configuration-policy-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="display-message-configuration-policy-body">
<hr/>
<div class="wr-input-control">
<label class="wr-input-label" for="lock-screen-message-policy-enable-system-apps">
Lock Screen Message
<span class="helper"
title="The message that needs to show on the lock-screen.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
</label>
<br>
<a id="policy-listing-status-msg"> Below lock screen message is valid only when the Agent is the
<b>device owner</b>.</a>
<br>
<textarea id="lock-screen-message" type="text"
class="form-control operationDataKeys" rows="4"
data-key="lockScreenMessage" disabled></textarea>
<br><br>
<label class="wr-input-label" for="setting-app-support-message-policy-enable-system-apps">
Setting App Support Message
<span class="helper"
title="The message that needs to show on the device administrators apps.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
</label>
<textarea id="setting-app-message" type="text"
class="form-control operationDataKeys" rows="4"
data-key="settingAppSupportMessage" disabled></textarea>
<br><br>
<label class="wr-input-label" for="disabled-setting-app-support-message-policy-enable-system-apps">
Disabled Setting Support Message
<span class="helper"
title="The message that needs to show on the screens where funtionality has been disabled by the admin.Max length is 200">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
</label>
<textarea id="disabled-setting-message" type="text"
class="form-control operationDataKeys" rows="4"
data-key="disabledSettingSupportMessage"
maxlength="200" disabled></textarea>
</div>
</div>
</div>
</div>
<!--/Display Message Configuration-->
</div>
<script type="text/javascript">applyDataTable();</script>
</div>

@ -56,7 +56,9 @@ var androidOperationConstants = {
"COSU_PROFILE_CONFIGURATION_OPERATION_CODE": "COSU_PROFILE",
"ENROLLMENT_APP_INSTALL": "enrollment-app-install",
"ENROLLMENT_APP_INSTALL_CODE": "ENROLLMENT_APP_INSTALL",
"CERTIFICATE_INSTALL": "INSTALL_CERT"
"CERTIFICATE_INSTALL": "INSTALL_CERT",
"DISPLAY_MESSAGE_CONFIGURATION_OPERATION": "display-message-configuration",
"DISPLAY_MESSAGE_CONFIGURATION_OPERATION_CODE": "DISPLAY_MESSAGE_CONFIGURATION"
};
/**
@ -593,6 +595,36 @@ var validatePolicyProfile = function () {
// updating validationStatusArray with validationStatus
validationStatusArray.push(validationStatus);
}
// Validating DISPLAY MESSAGE CONFIGURATION
if ($.inArray(androidOperationConstants["DISPLAY_MESSAGE_CONFIGURATION_OPERATION_CODE"], configuredOperations) !== -1) {
// if DISPLAY_MESSAGE_CONFIGURATION policy is configured
operation = androidOperationConstants["DISPLAY_MESSAGE_CONFIGURATION_OPERATION"];
// initializing continueToCheckNextInputs to true
continueToCheckNextInputs = true;
var lockScreenMessage = $("textarea#lock-screen-message").val();
var settingAppMessage = $("textarea#setting-app-message").val();
var disabledSettingMessage = $("textarea#disabled-setting-message").val();
if (!lockScreenMessage && !settingAppMessage && !disabledSettingMessage) {
validationStatus = {
"error": true,
"subErrorMsg": "Please fill at-least a one field.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
}
// at-last, if the value of continueToCheckNextInputs is still true
// this means that no error is found
if (continueToCheckNextInputs) {
validationStatus = {
"error": false,
"okFeature": operation
};
}
// updating validationStatusArray with validationStatus
validationStatusArray.push(validationStatus);
}
// Validating PROXY
if ($.inArray(androidOperationConstants["GLOBAL_PROXY_OPERATION_CODE"], configuredOperations) !== -1) {
@ -600,7 +632,6 @@ var validatePolicyProfile = function () {
operation = androidOperationConstants["GLOBAL_PROXY_OPERATION"];
// initializing continueToCheckNextInputs to true
continueToCheckNextInputs = true;
if ($("input#manual-proxy-configuration-radio-button").is(":checked")) {
var proxyHost = $("input#proxy-host").val();
var proxyPort = $("input#proxy-port").val();

@ -170,6 +170,18 @@
<span id="enrollment-app-install-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="enrollment-app-install-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<a href="javascript:void(0)" class="display-message-configuration" onclick="showAdvanceOperation('display-message-configuration', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-comment fw-stack-2x"></i>
</span>
Display Message Configuration
<span id="display-message-configuration-configured" class="has-configured status-icon hidden"><i
class="fw fw-success"></i></span>
<span id="display-message-configuration-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="display-message-configuration-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
</div>
<div class="wr-hidden-operations-content col-lg-8">
@ -3335,6 +3347,77 @@
</div>
</div>
<!--/enrolment-app-install-->
<!--Display Message Configuration-->
<div class="wr-hidden-operation" data-operation="display-message-configuration">
<div class="panel panel-default operation-data" data-operation="display-message-configuration" data-operation-code="DISPLAY_MESSAGE_CONFIGURATION">
<div id="display-message-configuration-policy-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Display Message Configuration
<label id="display-message-configuration-policy-lbl" class="wr-input-control switch" data-toggle="collapse"
data-target="#display-message-configuration-policy-body">
<input type="checkbox"/>
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
<div class="panel-title-description">
Configure these settings to manage the applications in the show message.
</div>
</div>
<div id="display-message-configuration-policy-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="display-message-configuration-policy-body">
<hr/>
<br>
<div id="display-message-configuration-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="lock-screen-message">
Lock Screen Message
<span class="helper"
title="The message that needs to show on the lock-screen.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
</label>
<br>
<a id="policy-listing-status-msg"> Below lock screen message is valid only when the Agent is the
<b>device owner</b>.</a>
<br>
<textarea id="lock-screen-message" type="text"
class="form-control operationDataKeys" rows="4"
data-key="lockScreenMessage"></textarea>
<br><br>
<label class="wr-input-label" for="setting-app-message">
Setting App Support Message
<span class="helper"
title="The message that needs to show on the device administrators apps.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
</label>
<textarea id="setting-app-message" type="text"
class="form-control operationDataKeys" rows="4"
data-key="settingAppSupportMessage"></textarea>
<br><br>
<label class="wr-input-label" for="disabled-setting-message">
Disabled Setting Support Message
<span class="helper"
title="The message that needs to show on the screens where funtionality has been disabled by the admin.Max length is 200">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
</label>
<textarea id="disabled-setting-message" type="text"
class="form-control operationDataKeys" rows="4"
data-key="disabledSettingSupportMessage"
maxlength="200"></textarea>
</div>
</div>
</div>
</div>
<!--/Display Message Configuration-->
</div>
<script type="text/javascript">applyDataTable();</script>
</div>

Loading…
Cancel
Save