dilanua 8 years ago
parent 9925a20964
commit 42a5493a89

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

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

Loading…
Cancel
Save