2 * ================================================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ================================================================================
\r
23 constructor(applicationsService,userProfileService, $log, $rootScope) {
\r
25 this.userProfileService = userProfileService;
\r
26 this.$rootScope = $rootScope;
\r
27 $rootScope.isAdminPortalAdmin = false;
\r
30 //if (bowser.msie || bowser.msedge)
\r
31 // $log.debug('SidebarCtrl::init: Browser is: Internet Explorer or Edge');
\r
33 // $log.debug('SidebarCtrl::init: Browser is: ' + bowser.name + ': ' + bowser.version);
\r
35 //note: this model should be retrieved from BE via sidebar specific service
\r
36 userProfileService.getUserProfile()
\r
39 if (profile.roles.indexOf('System Administrator') > -1) {
\r
40 $rootScope.isAdminPortalAdmin = true;
\r
42 this.$log.debug('SidebarCtrl::getUserProfile: user is not superAdmin nor admin');
\r
45 // $log.debug('SidebarCtrl::getUserProfile: profile.roles.indexOf(superAdmin) = ' + profile.roles.indexOf('superAdmin'));
\r
46 // $log.debug('SidebarCtrl::getUserProfile: profile.roles.indexOf(admin) = ' + profile.roles.indexOf('admin'));
\r
51 //console.log("Menu items is "+JSON.stringify(res));
\r
52 this.sidebarModel = res;
\r
54 //confirmBoxService.showInformation('There was a problem creating the menu. ' +
\r
55 // 'Please try again later. Error Status: '+ err.status).then(isConfirmed => {});
\r
56 $log.error('SidebarCtrl::getUserProfile: User Profile error occurred: ' + err);
\r
61 SidebarCtrl.$inject = ['applicationsService','userProfileService', '$log', '$rootScope'];
\r
62 angular.module('ecompApp').controller('SidebarCtrl', SidebarCtrl);
\r