Generate nav menu icons based on correct permissions

This commit fixes the mismatching permissions which are checked while generating navigation menu icons.
- Correct the wrong permission string used for configuration management.
- Introduce a new UI permission for certificate management.
- Move device type link under "owning device permission" which is the permission declared in the JAX-RS implementation.

Resolves wso2/product-iots#1782
revert-70aa11f8
Madawa Soysa 7 years ago
parent 7fe945f1bf
commit e5eeb78d09

@ -605,9 +605,12 @@ var userModule = function () {
if (publicMethods.isAuthorized("/permission/admin/device-mgt/dashboard/view")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/dashboard/view")) {
permissions["VIEW_DASHBOARD"] = true; permissions["VIEW_DASHBOARD"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/platform-configs/view")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/platform-configurations/view")) {
permissions["TENANT_CONFIGURATION"] = true; permissions["TENANT_CONFIGURATION"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/certificates/manage")) {
permissions["CERTIFICATE_MANAGEMENT"] = true;
}
if (publicMethods.isAuthorized("/permission/admin/device-mgt/devices/change-status")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/devices/change-status")) {
permissions["CHANGE_DEVICE_STATUS"] = true; permissions["CHANGE_DEVICE_STATUS"] = true;
} }

@ -29,8 +29,6 @@
Device Management Device Management
</a> </a>
</li> </li>
{{/if}}
{{#if permissions.IS_ADMIN}}
<li> <li>
<a href="{{@app.context}}/device-types"> <a href="{{@app.context}}/device-types">
<i class="fw fw-devices"></i> <i class="fw fw-devices"></i>
@ -90,11 +88,11 @@
</ul> </ul>
</li> </li>
{{/if}} {{/if}}
{{#if permissions.LIST_POLICIES}} {{#if permissions.LIST_ALL_POLICIES}}
<li><a href="{{@app.context}}/policies"><i class="fw fw-policy"></i>Policy Management</a></li> <li><a href="{{@app.context}}/policies"><i class="fw fw-policy"></i>Policy Management</a></li>
{{/if}} {{/if}}
{{#if permissions.TENANT_CONFIGURATION}} {{#if configMgtEnabled}}
{{#if isCloud}} {{#if isCloud}}
<li> <li>
@ -109,17 +107,15 @@
<li> <li>
<a><i class="fw fw-settings"></i>Configuration Management</a> <a><i class="fw fw-settings"></i>Configuration Management</a>
<ul> <ul>
<li> {{#if permissions.TENANT_CONFIGURATION}}
<a href="{{@app.context}}/platform-configuration"><i class="fw fw-service"></i> <li><a href="{{@app.context}}/platform-configuration"><i class="fw fw-service"></i>Platform Configurations</a>
Platform Configurations
</a>
</li> </li>
{{/if}}
{{#if permissions.CERTIFICATE_MANAGEMENT}}
<!-- todo change the permission and get the related permission --> <!-- todo change the permission and get the related permission -->
<li> <li><a href="{{@app.context}}/certificates"><i class="fw fw-security-policy"></i>Certificate Configurations</a>
<a href="{{@app.context}}/certificates"><i class="fw fw-security-policy"></i>
Certificate Configurations
</a>
</li> </li>
{{/if}}
{{#if iosPluginFlag}} {{#if iosPluginFlag}}
<li> <li>
<a href="{{@app.context}}/dep/devices"><i class="fw fw-apple"></i> <a href="{{@app.context}}/dep/devices"><i class="fw fw-apple"></i>
@ -138,11 +134,7 @@
<i class="fw fw-map-location"></i> <i class="fw fw-map-location"></i>
Device Locations Device Locations
</a> </a>
</li>
{{/if}} {{/if}}
{{/zone}} {{/zone}}
{{#zone "navbarCollapsableRightItems"}} {{#zone "navbarCollapsableRightItems"}}

@ -34,6 +34,7 @@ function onRequest(context) {
var uiPermissions = userModule.getUIPermissions(); var uiPermissions = userModule.getUIPermissions();
context["permissions"] = uiPermissions; context["permissions"] = uiPermissions;
context["userMgtEnabled"] = (uiPermissions["LIST_USERS"] || uiPermissions["LIST_ROLES"]); context["userMgtEnabled"] = (uiPermissions["LIST_USERS"] || uiPermissions["LIST_ROLES"]);
context["configMgtEnabled"] = (uiPermissions["CERTIFICATE_MANAGEMENT"] || uiPermissions["TENANT_CONFIGURATION"]);
var links = { var links = {
"user-mgt": [], "user-mgt": [],

Loading…
Cancel
Save