2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
23 constructor(userProfileService, $log, $rootScope) {
25 this.userProfileService = userProfileService;
26 this.$rootScope = $rootScope;
27 $rootScope.isAdminPortalAdmin = false;
29 //if (bowser.msie || bowser.msedge)
30 // $log.debug('SidebarCtrl::init: Browser is: Internet Explorer or Edge');
32 // $log.debug('SidebarCtrl::init: Browser is: ' + bowser.name + ': ' + bowser.version);
34 userProfileService.getUserProfile()
36 // $log.debug('SidebarCtrl::getUserProfile: profile.roles.indexOf(superAdmin) = ' + profile.roles.indexOf('superAdmin'));
37 // $log.debug('SidebarCtrl::getUserProfile: profile.roles.indexOf(admin) = ' + profile.roles.indexOf('admin'));
38 if (profile.roles.indexOf('superAdmin') > -1) {
39 $rootScope.isAdminPortalAdmin = true;
40 // this.$log.debug('SidebarCtrl::getUserProfile: user has the superAdmin role');
42 label: 'ECOMP portal',
46 state: 'root.applicationsHome',
49 name: 'Application Catalog',
50 state: 'root.appCatalog',
54 state: 'root.widgetsHome',
55 imageSrc : 'ion-android-apps'
59 imageSrc : 'ion-android-star'
63 imageSrc : 'ion-person'
65 name: 'Portal Admins',
66 state: 'root.portalAdmins',
67 imageSrc : 'ion-gear-a'
69 name: 'Application Onboarding',
70 state: 'root.applications',
71 imageSrc : 'ion-ios-upload-outline'
73 name: 'Widget Onboarding',
74 state: 'root.widgets',
75 imageSrc : 'ion-ios-upload-outline'
77 name: 'Edit Functional Menu',
78 state: 'root.functionalMenu',
79 imageSrc : 'ion-compose'
84 else if (profile.roles.indexOf('admin') > -1) {
85 // this.$log.debug('SidebarCtrl::getUserProfile: user has the admin role');
87 label: 'ECOMP portal',
91 state: 'root.applicationsHome',
94 name: 'Application Catalog',
95 state: 'root.appCatalog',
99 state: 'root.widgetsHome',
100 imageSrc : 'ion-grid'
104 imageSrc : 'ion-person'
106 name: 'Widget Onboarding',
107 state: 'root.widgets',
108 imageSrc : 'ion-grid'
114 $rootScope.isAdminPortalAdmin = false;
115 // this.$log.debug('SidebarCtrl::getUserProfile: user is not superAdmin nor admin');
116 this.sidebarModel = {
117 label: 'ECOMP portal',
121 state: 'root.applicationsHome',
122 imageSrc : 'ion-home'
124 name: 'Application Catalog',
125 state: 'root.appCatalog',
126 imageSrc : 'ion-grid'
129 state: 'root.widgetsHome',
130 imageSrc : 'ion-grid'
136 $log.error('SidebarCtrl: failed to get user profile: ' + err);
141 SidebarCtrl.$inject = ['userProfileService', '$log', '$rootScope'];
142 angular.module('ecompApp').controller('SidebarCtrl', SidebarCtrl);