dilanua 8 years ago
parent 9925a20964
commit 42a5493a89

@ -25,12 +25,13 @@
<li>
<a href="{{@app.context}}">
<i class="fw fw-dashboard"></i>
Admin Dashboard
Resource Dashboard
</a>
</li>
{{#if permissions.LIST_DEVICES}}
<li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/devices">
<i class="fw fw-mobile"></i>
Device Management
@ -38,33 +39,41 @@
</li>
{{/if}}
{{#if permissions.USER_MGT_PERMITTED}}
<li><a><i class="fw fw-user"></i>User Management</a>
<ul>
{{#if permissions.LIST_USERS}}
<li><a href="{{@app.context}}/users"><i class="fw fw-user"></i>Users</a></li>
<li><!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/users"><i class="fw fw-user"></i>Users</a></li>
{{/if}}
{{#if permissions.LIST_ROLES}}
<li><a href="{{@app.context}}/roles"><i class="fw fw-bookmark"></i>Roles</a></li>
<li><!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/roles"><i class="fw fw-bookmark"></i>Roles</a></li>
{{/if}}
</ul>
</li>
{{/if}}
{{#if permissions.LIST_POLICIES}}
<li><a href="{{@app.context}}/policies"><i class="fw fw-policy"></i>Policy Management</a></li>
<li><!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/policies"><i class="fw fw-policy"></i>Policy Management</a></li>
{{/if}}
{{#if permissions.CONFIG_MGT_PERMITTED}}
<li><a><i class="fw fw-settings"></i>Configuration Management</a>
<ul>
{{#if permissions.LIST_CONFIGURATION}}
<li><a href="{{@app.context}}/platform-configuration"><i class="fw fw-service"></i>Platform Configurations</a>
{{#if permissions.LIST_PLATFORM_CONFIGURATIONS}}
<li><!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/platform-configuration"><i class="fw fw-service"></i>Platform Configurations</a>
</li>
{{/if}}
<!-- todo change the permission and get the related permission -->
{{#if permissions.LIST_CONFIGURATION}}
<li><a href="{{@app.context}}/certificates"><i class="fw fw-security-policy"></i>Certificate Configurations</a>
{{#if permissions.LIST_CERTIFICATES}}
<li><!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/certificates"><i class="fw fw-security-policy"></i>Certificate Configurations</a>
</li>
{{/if}}
</ul>
</li>
{{/if}}
{{/zone}}
{{#zone "navbarCollapsableRightItems"}}
@ -83,6 +92,7 @@
</ul>
{{/zone}}
{{#zone "sidePanes"}}
<!--suppress HtmlUnknownAttribute -->
<div class="sidebar-wrapper" id="right-sidebar" is-authorized="{{permissions.LIST_NOTIFICATIONS}}"
data-side="right" data-width="320" data-sidebar-fixed="true" data-fixed-offset="50" data-spy="affix"
data-offset-top="80">
@ -92,6 +102,7 @@
</div>
{{/zone}}
{{#zone "bottomJs"}}
<!--suppress HtmlUnknownTarget -->
<script id="notifications" data-current-user="{{currentUser.username}}"
data-image-resource="{{@unit.publicUri}}/images/" src="{{@unit.publicUri}}/templates/notifications.hbs"
type="text/x-handlebars-template"></script>

@ -43,16 +43,20 @@ function onRequest(context) {
// eg: {{unit "appbar" pageLink="users" title="User Management"}}
viewModel["currentActions"] = links[viewModel["pageLink"]];
viewModel["enrollmentURL"] = mdmProps["generalConfig"]["host"] + mdmProps["enrollmentDir"];
var currentUser = session.get(constants["USER_SESSION_KEY"]);
viewModel["currentUser"] = session.get(constants["USER_SESSION_KEY"]);
var permissions = {};
permissions.LIST_DEVICES = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view");
permissions.LIST_POLICIES = userModule.isAuthorized("/permission/admin/device-mgt/policies/view");
permissions.LIST_ROLES = userModule.isAuthorized("/permission/admin/device-mgt/roles/view");
permissions.LIST_USERS = userModule.isAuthorized("/permission/admin/device-mgt/users/view");
permissions.LIST_NOTIFICATIONS = userModule.isAuthorized("/permission/admin/device-mgt/notifications/view");
permissions.LIST_CONFIGURATION = userModule.isAuthorized("/permission/admin/device-mgt/platform-configurations/view");
viewModel.permissions = permissions;
viewModel["currentUser"] = currentUser;
permissions["LIST_DEVICES"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view");
permissions["LIST_POLICIES"] = userModule.isAuthorized("/permission/admin/device-mgt/policies/view");
permissions["LIST_USERS"] = userModule.isAuthorized("/permission/admin/device-mgt/users/view");
permissions["LIST_ROLES"] = userModule.isAuthorized("/permission/admin/device-mgt/roles/view");
permissions["USER_MGT_PERMITTED"] = (permissions["LIST_USERS"] || permissions["LIST_ROLES"]);
permissions["LIST_PLATFORM_CONFIGURATIONS"] = userModule.isAuthorized("/permission/admin/device-mgt/platform-configurations/view");
permissions["LIST_CERTIFICATES"] = userModule.isAuthorized("/permission/admin/device-mgt/certificates/view");
permissions["CONFIG_MGT_PERMITTED"] = (permissions["LIST_PLATFORM_CONFIGURATIONS"] || permissions["LIST_CERTIFICATES"]);
permissions["LIST_NOTIFICATIONS"] = userModule.isAuthorized("/permission/admin/device-mgt/notifications/view");
viewModel["permissions"] = permissions;
viewModel["appContext"] = mdmProps["appContext"];
return viewModel;

Loading…
Cancel
Save