From 7e2b3220eaf65d3b438dfaa71a4d235c0415b567 Mon Sep 17 00:00:00 2001 From: Pasindu Date: Thu, 22 Jun 2017 14:02:58 +0530 Subject: [PATCH] COSU profile configuration policy UI added. --- .../public/js/operation-mod.js | 41 ++- .../public/js/android-policy-edit.js | 38 ++- .../public/templates/android-policy-edit.hbs | 296 ++++++++++++++++- .../public/templates/android-policy-view.hbs | 301 +++++++++++++++++- .../public/js/android-policy-operations.js | 3 - .../templates/android-policy-operations.hbs | 234 ++++++++++++-- 6 files changed, 836 insertions(+), 77 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js index c7f01e31e..a290c72f5 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js @@ -77,7 +77,9 @@ var androidOperationModule = function () { "SYSTEM_UPDATE_POLICY_CODE": "SYSTEM_UPDATE_POLICY", "KIOSK_APPS_CODE": "KIOSK_APPS", "RUNTIME_PERMISSION_POLICY_OPERATION": "runtime-permission-policy", - "RUNTIME_PERMISSION_POLICY_OPERATION_CODE": "RUNTIME_PERMISSION_POLICY" + "RUNTIME_PERMISSION_POLICY_OPERATION_CODE": "RUNTIME_PERMISSION_POLICY", + "COSU_PROFILE_CONFIGURATION_OPERATION": "cosu-profile-configuration", + "COSU_PROFILE_CONFIGURATION_OPERATION_CODE": "COSU_PROFILE" }; /** @@ -160,9 +162,16 @@ var androidOperationModule = function () { } break; case androidOperationConstants["RUNTIME_PERMISSION_POLICY_OPERATION_CODE"]: - payload ={"defaultRuntimePermissionType": operationPayload["defaultType"] - }; - break; + payload = { + "defaultType": operationPayload["defaultPermissionType"], + "permittedApplications": operationPayload["permittedApplications"] + }; + break; + case androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION_CODE"]: + payload = { + "cosuProfileRestrictionStartTime": operationPayload["cosuProfileOperationRestrictionEndTime"], + "cosuProfileRestrictionEndTime": operationPayload["cosuProfileOperationRestrictionEndTime"] + } case androidOperationConstants["KIOSK_APPS_CODE"]: payload = { "cosuWhitelistedApplications": operationPayload["whitelistedApplications"] @@ -332,13 +341,23 @@ var androidOperationModule = function () { }; break; case androidOperationConstants["RUNTIME_PERMISSION_POLICY_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "type": operationData["runtimePermissionPolicyPermissionType"] - } - }; - break; + operationType = operationTypeConstants["PROFILE"]; + payload = { + "operation": { + "defaultType": operationData["defaultPermissionType"], + "permittedApplications": operationData["permittedApplications"] + } + }; + break; + case androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION_CODE"]: + operationType = operationTypeConstants["PROFILE"]; + payload = { + "operation": { + "cosuProfileRestrictionStartTime": operationData["cosuProfileOperationRestrictionStartTime"], + "cosuProfileRestrictionEndTime": operationData["cosuProfileOperationRestrictionEndTime"] + } + }; + break; case androidOperationConstants["SYSTEM_UPDATE_POLICY_CODE"]: operationType = operationTypeConstants["PROFILE"]; if (operationData["cosuSystemUpdatePolicyType"] != "window") { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js index 1448d6650..c18f204d7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js @@ -33,7 +33,11 @@ var androidOperationConstants = { "APPLICATION_OPERATION": "app-restriction", "APPLICATION_OPERATION_CODE": "APP-RESTRICTION", "KIOSK_APPS_CODE": "KIOSK_APPS", - "KIOSK_APPS": "cosu-whitelisted-applications" + "KIOSK_APPS": "cosu-whitelisted-applications", + "RUNTIME_PERMISSION_POLICY_OPERATION_CODE": "RUNTIME_PERMISSION_POLICY", + "RUNTIME_PERMISSION_POLICY_OPERATION": "runtime-permission-policy", + "COSU_PROFILE_CONFIGURATION_OPERATION": "cosu-profile-configuration", + "COSU_PROFILE_CONFIGURATION_OPERATION_CODE": "COSU_PROFILE" }; /** @@ -221,6 +225,15 @@ var validatePolicyProfile = function () { // updating validationStatusArray with validationStatus validationStatusArray.push(validationStatus); } + // Validating COSU PROFILE CONFIGURATION + if ($.inArray(androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION_CODE"], configuredOperations) != -1) { + operation = androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION"]; + validationStatus = { + "error": false, + "okFeature": operation + }; + validationStatusArray.push(validationStatus); + } // Validating ENCRYPT_STORAGE if ($.inArray(androidOperationConstants["ENCRYPT_STORAGE_OPERATION_CODE"], configuredOperations) != -1) { // if ENCRYPT_STORAGE is configured @@ -234,18 +247,17 @@ var validatePolicyProfile = function () { validationStatusArray.push(validationStatus); } // Validating RUNTIME_PERMISSION - if ($.inArray(androidOperationConstants["RUNTIME_PERMISSION_POLICY_OPERATION_CODE"], configuredOperations) != -1) { - // if ENCRYPT_STORAGE is configured - operation = androidOperationConstants["RUNTIME_PERMISSION_POLICY_OPERATION"]; - // updating validationStatus - validationStatus = { - "error": false, - "okFeature": operation - }; - // updating validationStatusArray with validationStatus - validationStatusArray.push(validationStatus); - } - + if ($.inArray(androidOperationConstants["RUNTIME_PERMISSION_POLICY_OPERATION_CODE"], configuredOperations) != -1) { + // if policy is configured + operation = androidOperationConstants["RUNTIME_PERMISSION_POLICY_OPERATION"]; + // updating validationStatus + validationStatus = { + "error": false, + "okFeature": operation + }; + // updating validationStatusArray with validationStatus + validationStatusArray.push(validationStatus); + } // Validating WIFI if ($.inArray(androidOperationConstants["WIFI_OPERATION_CODE"], configuredOperations) != -1) { // if WIFI is configured diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs index 5b7ce535a..4c0cb2771 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs @@ -75,6 +75,17 @@ + + + + + COSU Profile Configurations + + + + @@ -1225,7 +1236,7 @@ data-operation-code="RUNTIME_PERMISSION_POLICY"> + + +
+
+ +
+
+ +
+
+
+ + +
+
+
+
+ + +
+
+ + +
+ +
+
+
+
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/templates/android-policy-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/templates/android-policy-view.hbs index 807524b60..3065de171 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/templates/android-policy-view.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/templates/android-policy-view.hbs @@ -58,6 +58,16 @@ + + + + + COSU Profile Configurations + + + + @@ -934,6 +944,181 @@
+ + +
+ +
+ +
+
-
+
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/js/android-policy-operations.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/js/android-policy-operations.js index 977977bb4..56d0b4ec9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/js/android-policy-operations.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/js/android-policy-operations.js @@ -33,9 +33,6 @@ var androidOperationConstants = { "APPLICATION_OPERATION_CODE": "APP-RESTRICTION", "KIOSK_APPS_CODE": "KIOSK_APPS", "KIOSK_APPS": "cosu-whitelisted-applications", - "RUNTIME_PERMISSION_POLICY_OPERATION": "runtime-permission-policy", - "RUNTIME_PERMISSION_POLICY_OPERATION_CODE": "RUNTIME_PERMISSION_POLICY" - }; /** diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs index df1181f71..8b4f9de95 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs @@ -76,6 +76,17 @@ + + + + + COSU Profile Configurations + + + + @@ -91,9 +102,9 @@ - + - Runtime Permission Policy (COSU) + Runtime Permission Policy + +
@@ -1231,13 +1414,14 @@
+