From 4780926f008a20b6deb0df0eb249ea61b4a3c958 Mon Sep 17 00:00:00 2001 From: yangkai Date: Fri, 26 Oct 2018 17:39:48 +0800 Subject: [PATCH] [fix]permissions --- .../bdprize/templates/bd_prize_root.html | 10 ++-- .../ui/static/config/sysconfigs/sysconfigs.js | 46 +++++++++++++++-- .../templates/permission_config.html | 49 ++++++++++++++----- 3 files changed, 86 insertions(+), 19 deletions(-) diff --git a/src/main/ui/static/config/bdprize/templates/bd_prize_root.html b/src/main/ui/static/config/bdprize/templates/bd_prize_root.html index 5baefdd15..74c51ffa4 100644 --- a/src/main/ui/static/config/bdprize/templates/bd_prize_root.html +++ b/src/main/ui/static/config/bdprize/templates/bd_prize_root.html @@ -7,21 +7,21 @@
-
+
-
+
- - - + +
diff --git a/src/main/ui/static/config/sysconfigs/sysconfigs.js b/src/main/ui/static/config/sysconfigs/sysconfigs.js index 7b3842119..04a216864 100644 --- a/src/main/ui/static/config/sysconfigs/sysconfigs.js +++ b/src/main/ui/static/config/sysconfigs/sysconfigs.js @@ -119,8 +119,8 @@ define(['angular', 'uiRouter'], function (angular) { } }]); - app.controller('permissionConfigRootCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) { - $scope.authorizeRole = function (roleMask) { + app.controller('permissionConfigRootCtrl', ['$scope', '$filter', '$http', '$uibModal','commonDialog', function ($scope, $filter, $http, $uibModal,commonDialog) { + /*$scope.authorizeRole = function (roleMask) { $uibModal.open({ templateUrl: '/static/config/sysconfigs/templates/permission_authorize_dialog.html', controller: 'permissionAuthorizeDialogCtrl', @@ -137,7 +137,47 @@ define(['angular', 'uiRouter'], function (angular) { } } }); - } + };*/ + $scope.role = 1; + var roleParam = angular.copy($scope.role); + $scope.authorizeRole = function (roleMask) { + $scope.role = roleMask; + $http.get('/sys/permission/functions').then(function (resp) { + $scope.modules = resp.data; + }); + $http.get('/sys/permission/roles/' + roleMask + '/functions').then(function (resp) { + $scope.authorized = resp.data; + }); + }; + $scope.submitAuthorize = function () { + commonDialog.confirm({ + title: '修改角色接口权限', + content: '你确定修改当前角色接口权限吗?' + }).then(function () { + $http.put('/sys/permission/roles/' + $scope.role + '/functions', $scope.authorized).then(function () { + commonDialog.alert({title: 'Success', content: '修改成功.', type: 'success'}) + }, function (resp) { + commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message}) + }) + }) + + }; + $scope.toggleAuthorize = function (func) { + var idx = $scope.authorized.indexOf(func.func_id); + if (idx >= 0) { + $scope.authorized.splice(idx, 1); + } else { + $scope.authorized.push(func.func_id); + } + }; + $scope.moduleName = 'actChairty'; + $scope.filterAuthorized = function (module) { + return module.module_name === $scope.moduleName; + }; + $scope.switchModule = function (moduleName) { + $scope.moduleName = moduleName; + }; + $scope.authorizeRole(roleParam); }]); app.controller('permissionAuthorizeDialogCtrl', ['$scope', '$http', 'authorized', 'modules', 'role', function ($scope, $http, authorized, modules, role) { diff --git a/src/main/ui/static/config/sysconfigs/templates/permission_config.html b/src/main/ui/static/config/sysconfigs/templates/permission_config.html index 057ac1568..059b734e1 100644 --- a/src/main/ui/static/config/sysconfigs/templates/permission_config.html +++ b/src/main/ui/static/config/sysconfigs/templates/permission_config.html @@ -1,3 +1,11 @@ +

Permission Config