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(applicationsService,userProfileService, $log, $rootScope) {
25 this.userProfileService = userProfileService;
26 this.$rootScope = $rootScope;
27 $rootScope.isAdminPortalAdmin = false;
30 //if (bowser.msie || bowser.msedge)
31 // $log.debug('SidebarCtrl::init: Browser is: Internet Explorer or Edge');
33 // $log.debug('SidebarCtrl::init: Browser is: ' + bowser.name + ': ' + bowser.version);
35 //note: this model should be retrieved from BE via sidebar specific service
36 userProfileService.getUserProfile()
39 if (profile.roles.indexOf('System Administrator') > -1) {
40 $rootScope.isAdminPortalAdmin = true;
42 this.$log.debug('SidebarCtrl::getUserProfile: user is not superAdmin nor admin');
45 // $log.debug('SidebarCtrl::getUserProfile: profile.roles.indexOf(superAdmin) = ' + profile.roles.indexOf('superAdmin'));
46 // $log.debug('SidebarCtrl::getUserProfile: profile.roles.indexOf(admin) = ' + profile.roles.indexOf('admin'));
51 //console.log("Menu items is "+JSON.stringify(res));
52 this.sidebarModel = res;
54 //confirmBoxService.showInformation('There was a problem creating the menu. ' +
55 // 'Please try again later. Error Status: '+ err.status).then(isConfirmed => {});
56 $log.error('SidebarCtrl::getUserProfile: User Profile error occurred: ' + err);
61 SidebarCtrl.$inject = ['applicationsService','userProfileService', '$log', '$rootScope'];
62 angular.module('ecompApp').controller('SidebarCtrl', SidebarCtrl);