2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
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 * ============LICENSE_END=========================================================
20 app.controller('policyRolesController', function ($scope, PolicyAppService, modalService, $modal, Notification){
21 $( "#dialog" ).hide();
23 $scope.isDisabled = true;
25 PolicyAppService.getData('get_LockDownData').then(function(data) {
27 $scope.data = JSON.parse(j.data);
28 $scope.lockdowndata = JSON.parse($scope.data.lockdowndata);
29 if ($scope.lockdowndata[0].lockdown == true) {
30 $scope.isDisabled = true;
32 $scope.isDisabled = false;
34 console.log($scope.data);
36 console.log("failed");
39 $scope.scopeDatas = [];
40 PolicyAppService.getData('get_RolesData').then(function (data) {
42 $scope.data = JSON.parse(j.data);
43 console.log($scope.data);
44 $scope.rolesDatas = JSON.parse($scope.data.rolesDatas);
45 console.log($scope.rolesDatas);
47 console.log("failed");
50 $scope.rolesTableGrid = {
52 enableFiltering: true,
54 field: 'id', enableFiltering: false, headerCellTemplate: '' +
55 '<button id=\'New\' ng-click="grid.appScope.editRolesWindow(null)" class="btn btn-success">' + 'Create</button>',
57 '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editRolesWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button>' , width: '4%'
59 { field: 'loginId.userName', displayName : 'Name', sort: { direction: 'asc', priority: 0 }},
60 { field: 'scope', displayName : 'Scope' },
61 { field: 'role', displayName : 'Role' }
66 $scope.editRoleName = null;
68 $scope.editRolesWindow = function(editRoleData) {
69 if ($scope.lockdowndata[0].lockdown == true) {
70 Notification.error("Policy Application has been Locked")
72 $scope.editRoleName = editRoleData;
73 var modalInstance = $modal.open({
74 backdrop: 'static', keyboard: false,
75 templateUrl : 'edit_Role_popup.html',
76 controller: 'editRoleController',
78 message: function () {
80 editRoleData: $scope.editRoleName
86 modalInstance.result.then(function(response) {
87 console.log('response', response);
88 $scope.rolesDatas = response.rolesDatas;