Merge pull request #710 from rasika/master

Fixing Policy view and policy edit doesn't honor isCloud param
4.x.x
Harshan Liyanage 8 years ago committed by GitHub
commit b9691988a9

@ -1,7 +1,7 @@
{{#zone "content"}} {{#zone "content"}}
{{#if isAuthorized}} {{#if isAuthorized}}
<span id="logged-in-user" class="hidden" data-username="{{user.username}}" data-domain="{{user.domain}}" <span id="logged-in-user" class="hidden" data-username="{{@user.username}}" data-domain="{{@user.domain}}"
data-tenant-id="{{user.tenantId}}" data-iscloud="{{isCloud}}"></span> data-tenant-id="{{@user.tenantId}}" data-iscloud="{{isCloud}}"></span>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">

@ -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(); var roles = userModule.getRoles();
if (roles["status"] == "success") { if (roles["status"] == "success") {
types["roles"] = roles["content"]; types["roles"] = roles["content"];

@ -1,7 +1,7 @@
{{#zone "content"}} {{#zone "content"}}
{{#if isAuthorized }} {{#if isAuthorized }}
<span id="logged-in-user" class="hidden" data-username="{{user.username}}" data-domain="{{user.domain}}" <span id="logged-in-user" class="hidden" data-username="{{@user.username}}" data-domain="{{@user.domain}}"
data-tenant-id="{{user.tenantId}}"></span> data-tenant-id="{{@user.tenantId}}" data-iscloud="{{isCloud}}"></span>
<span id="policy-operations" class="hidden" data-template="{{policyOperations.template}}" <span id="policy-operations" class="hidden" data-template="{{policyOperations.template}}"
data-script="{{policyOperations.script}}" data-style="{{policyOperations.style}}"></span> data-script="{{policyOperations.script}}" data-style="{{policyOperations.style}}"></span>
<div class="row"> <div class="row">

@ -60,5 +60,8 @@ function onRequest(context) {
context.isAuthorizedViewRoles = userModule.isAuthorized("/permission/admin/device-mgt/users/view"); context.isAuthorizedViewRoles = userModule.isAuthorized("/permission/admin/device-mgt/users/view");
context.isAuthorizedViewGroups = userModule.isAuthorized("/permission/admin/device-mgt/groups/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; return context;
} }

@ -196,7 +196,7 @@ skipStep["policy-platform"] = function (policyPayloadObj) {
hasPolicyProfileScript = false; hasPolicyProfileScript = false;
} }
$.template(policyEditTemplateCacheKey, context + policyEditTemplateSrc, function (template) { $.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"); $("#device-type-policy-operations").html(content).removeClass("hidden");
$(".policy-platform").addClass("hidden"); $(".policy-platform").addClass("hidden");
if (hasPolicyProfileScript) { if (hasPolicyProfileScript) {

@ -84,7 +84,7 @@ var displayPolicy = function (policyPayloadObj) {
hasPolicyProfileScript = false; hasPolicyProfileScript = false;
} }
$.template(policyViewTemplateCacheKey, context + policyViewTemplateSrc, function (template) { $.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"); $("#device-type-policy-operations").html(content).removeClass("hidden");
$(".policy-platform").addClass("hidden"); $(".policy-platform").addClass("hidden");
if (hasPolicyProfileScript) { if (hasPolicyProfileScript) {

@ -1,5 +1,7 @@
{{#zone "content"}} {{#zone "content"}}
{{#if isAuthorized}} {{#if isAuthorized}}
<span id="logged-in-user" class="hidden" data-username="{{@user.username}}" data-domain="{{@user.domain}}"
data-tenant-id="{{@user.tenantId}}" data-iscloud="{{isCloud}}"></span>
{{#defineZone "policy-profile-top"}} {{#defineZone "policy-profile-top"}}
<div class="row wr-device-board"> <div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar"> <div class="col-lg-12 wr-secondary-bar">

@ -39,5 +39,9 @@ function onRequest(context) {
} }
} }
page.isAuthorized = userModule.isAuthorized("/permission/admin/device-mgt/policies/view"); 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; return page;
} }
Loading…
Cancel
Save