From 636f0cbe98b65ea6670b97e8c4207de6bfd69598 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Tue, 25 Apr 2017 10:57:30 +0530 Subject: [PATCH] #706 : Policy view and policy edit doesn't honor isCloud enabled parameter --- .../devicemgt/app/units/cdmf.unit.policy.create/create.hbs | 4 ++-- .../devicemgt/app/units/cdmf.unit.policy.create/create.js | 2 -- .../devicemgt/app/units/cdmf.unit.policy.edit/edit.hbs | 4 ++-- .../devicemgt/app/units/cdmf.unit.policy.edit/edit.js | 3 +++ .../app/units/cdmf.unit.policy.edit/public/js/policy-edit.js | 2 +- .../app/units/cdmf.unit.policy.view/public/js/view.js | 2 +- .../devicemgt/app/units/cdmf.unit.policy.view/view.hbs | 2 ++ .../devicemgt/app/units/cdmf.unit.policy.view/view.js | 4 ++++ 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs index 95b7f33c54..6370b68924 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs @@ -1,7 +1,7 @@ {{#zone "content"}} {{#if isAuthorized}} - +
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.js index a5d7846d54..232f9f5078 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.js @@ -67,8 +67,6 @@ function onRequest(context) { } } - var user = userModule.getCarbonUser(); - types["user"] = {username: user.username, domain: user.domain, tenantId: user.tenantId}; var roles = userModule.getRoles(); if (roles["status"] == "success") { types["roles"] = roles["content"]; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.hbs index 44a501021d..1f3041b8ce 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.hbs @@ -1,7 +1,7 @@ {{#zone "content"}} {{#if isAuthorized }} - +
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.js index 4f7f10346e..0ce34c537b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.js @@ -60,5 +60,8 @@ function onRequest(context) { context.isAuthorizedViewRoles = userModule.isAuthorized("/permission/admin/device-mgt/users/view"); context.isAuthorizedViewGroups = userModule.isAuthorized("/permission/admin/device-mgt/groups/view"); + var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; + context["isCloud"] = devicemgtProps.isCloud; + return context; } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js index 309f7ea640..7296b3ed89 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js @@ -196,7 +196,7 @@ skipStep["policy-platform"] = function (policyPayloadObj) { hasPolicyProfileScript = false; } $.template(policyEditTemplateCacheKey, context + policyEditTemplateSrc, function (template) { - var content = template(); + var content = template({"iscloud" : $("#logged-in-user").data("iscloud")}); $("#device-type-policy-operations").html(content).removeClass("hidden"); $(".policy-platform").addClass("hidden"); if (hasPolicyProfileScript) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js index 8ff991b1ef..73f504e81e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js @@ -84,7 +84,7 @@ var displayPolicy = function (policyPayloadObj) { hasPolicyProfileScript = false; } $.template(policyViewTemplateCacheKey, context + policyViewTemplateSrc, function (template) { - var content = template(); + var content = template({"iscloud" : $("#logged-in-user").data("iscloud")}); $("#device-type-policy-operations").html(content).removeClass("hidden"); $(".policy-platform").addClass("hidden"); if (hasPolicyProfileScript) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs index ca5b9d3969..4eb0628de2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs @@ -1,5 +1,7 @@ {{#zone "content"}} {{#if isAuthorized}} + {{#defineZone "policy-profile-top"}}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.js index af53c46116..8dcefb24bc 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.js @@ -39,5 +39,9 @@ function onRequest(context) { } } page.isAuthorized = userModule.isAuthorized("/permission/admin/device-mgt/policies/view"); + + var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; + page["isCloud"] = devicemgtProps.isCloud; + return page; } \ No newline at end of file