diff --git a/app/hardware/server/assign/assign.component.js b/app/hardware/server/assign/assign.component.js index 992f1384..65bf4c2f 100644 --- a/app/hardware/server/assign/assign.component.js +++ b/app/hardware/server/assign/assign.component.js @@ -29,6 +29,7 @@ }; assign.client = { modal: assignClientModal, + subSuperAccess: hasSubSuperAccess, //why doesnt this work? }; assign.saveNickname = saveNickname; @@ -62,5 +63,9 @@ function assignClientModal() { return ServerAssignModal.client([assign.server], assign.server.access.sub); } + + function hasSubSuperAccess() { + return false; //why doesnt this work? putting false in above works but this doesnt. + } } })(); diff --git a/app/hardware/server/assign/assign.pug b/app/hardware/server/assign/assign.pug index 1b0ee209..9b81305e 100644 --- a/app/hardware/server/assign/assign.pug +++ b/app/hardware/server/assign/assign.pug @@ -19,7 +19,7 @@ include /resources/angle/pug/mixins/panel th.shrink.v-mid(translate="server.assign.SRV_ID") td(ng-bind="assign.server.srv_id") - tr + tr(ng-if="assign.client.subSuperAccess") th.shrink.v-mid(translate="server.assign.client.TITLE") td(ng-init="access = assign.server.access") a( diff --git a/app/user/user.nav.config.js b/app/user/user.nav.config.js new file mode 100644 index 00000000..397e5271 --- /dev/null +++ b/app/user/user.nav.config.js @@ -0,0 +1,20 @@ +(function () { + 'use strict'; + + angular + .module('app.user') + .config(NavConfig) + ; + + /** + * @ngInject + */ + function NavConfig(NavProvider) { + NavProvider + .group('user', { + translate: "nav.USERS", + sref: "app.account.settings", + icon: "fa fa-user", + }); + } +})(); diff --git a/app/user/user.sidebar.js b/app/user/user.sidebar.js index 5d3b389b..a82e3c64 100644 --- a/app/user/user.sidebar.js +++ b/app/user/user.sidebar.js @@ -1,28 +1,62 @@ (function () { 'use strict'; + var MY_ACCOUNT = { + text: "My Account", + sref: "app.account.settings", + }; + + var SUB_CLIENTS = { + text: "Sub Clients", + sref: "app.user.client.sub.list", + }; + + var SUPER_CLIENTS = { + text: "Super Clients", + sref: "app.user.client.super.list", + }; + angular .module('app.user') - .config(NavConfig) + .run(UserSidebarShowWithPermissions) ; /** * @ngInject */ - function NavConfig(NavProvider) { - NavProvider.group('user', { - translate: "nav.USERS", - sref: "app.account.settings", - icon: "fa fa-user", - }).item({ - text: "My Account", - sref: "app.account.settings", - }).item({ - text: "Sub Clients", - sref: "app.user.client.sub.list", - }).item({ - text: "Super Clients", - sref: "app.user.client.super.list" - }); + function UserSidebarShowWithPermissions(Auth, Select /*, Permission*/) { + var userSidebar = this; + //Need to import Auth and Permission here. Why doesn't this work? in install.nav.config.js and search.tab.js + //this is used in seemingly the exact same way. + userSidebar.group = Select('group'); + // var group = NavProvider.group('user', { + // translate: "nav.USERS", + // sref: "app.account.settings", + // icon: "fa fa-user", + // }); + + Auth.whileLoggedIn(showPermitted, hide); + + // function show() { + // Permission + // .map() + // .then(showPermitted) + // ; + // } + + function showPermitted(map) { + group.item(MY_ACCOUNT); + + // if (showSubAndSuperClientPages) { + group.item(SUB_CLIENTS); + group.item(SUPER_CLIENTS); + // } + } + + function hide() { + group.remove(MY_ACCOUNT); + group.remove(SUB_CLIENTS); + group.remove(SUPER_CLIENTS); + } } })();