[fix]permissions

master
yangkai 6 years ago
parent 8ae8685487
commit 4780926f00

@ -7,21 +7,21 @@
</ol>
</section>
<section class="content">
<div class="box box-danger" ng-if="('1000'|withRole) || ('1000000'|withRole) || ('10000000000000'|withRole)">
<div class="box box-danger" ng-if="('10000000000000'|withRole)">
<div class="box-body">
<div class="box box-default">
<div class="box-body">
<div class="form-inline">
<div class="form-group" ng-if="!('1000000'|withRole)">
<div class="form-group">
<input type="text" class="form-control" uib-datepicker-popup="yyyy-MM" ng-model="generate.month"
is-open="ctrl.genmonth" datepicker-options="{minMode: 'month'}"
ng-click="ctrl.genmonth=true" placeholder="Select Month"/>
</div>
<button ng-if="!('1000000'|withRole)" class="btn btn-primary" ng-click="generateReport()" ng-disabled="!generate.month">
<button class="btn btn-primary" ng-click="generateReport()" ng-disabled="!generate.month">
Generate Report
</button>
<button ng-if="'10000000000000'|withRole" class="btn btn-primary" ng-click="editRateConfig()"><i class="fa fa-cog"></i> Edit Rate Config</button>
<button ng-if="'10000000000000'|withRole" class="btn btn-primary" ng-click="editBDLevels()"><i class="fa fa-user"></i> Edit BD Level</button>
<button class="btn btn-primary" ng-click="editRateConfig()"><i class="fa fa-cog"></i> Edit Rate Config</button>
<button class="btn btn-primary" ng-click="editBDLevels()"><i class="fa fa-user"></i> Edit BD Level</button>
<loadingbar ng-if="generate.status"></loadingbar>
</div>
</div>

@ -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) {

@ -1,3 +1,11 @@
<style>
.isSelect{
color:#337ab7;
}
.tab-content a:hover {
color:#337ab7;
}
</style>
<section class="content-header">
<h1>Permission Config</h1>
<ol class="breadcrumb">
@ -23,23 +31,23 @@
</li>
</ul>
<div class="tab-content" ui-view>
<a class="btn btn-app" role="button" ng-click="authorizeRole('1')">
<a class="btn btn-app" ng-class="{'isSelect':role=='1'}" role="button" ng-click="authorizeRole('1')">
<i class="fa fa-user-secret"></i>
Administrator
</a>
<a class="btn btn-app" role="button" ng-click="authorizeRole('10')">
<a class="btn btn-app" ng-class="{'isSelect':role=='10'}" role="button" ng-click="authorizeRole('10')">
<i class="fa fa-eye"></i>
Compliance
</a>
<a class="btn btn-app" role="button" ng-click="authorizeRole('100')">
<a class="btn btn-app" ng-class="{'isSelect':role=='100'}" role="button" ng-click="authorizeRole('100')">
<i class="fa fa-crosshairs"></i>
BD User
</a>
<a class="btn btn-app" role="button" ng-click="authorizeRole('1000')">
<a class="btn btn-app" ng-class="{'isSelect':role=='1000'}" role="button" ng-click="authorizeRole('1000')">
<i class="fa fa-balance-scale"></i>
Accountant
</a>
<a class="btn btn-app" role="button" ng-click="authorizeRole('10000')">
<a class="btn btn-app" ng-class="{'isSelect':role=='10000'}" role="button" ng-click="authorizeRole('10000')">
<i class="fa fa-tty"></i>
Service
</a>
@ -47,23 +55,23 @@
<!--<i class="fa fa-university"></i>-->
<!--Account Manager-->
<!--</a>-->
<a class="btn btn-app" role="button" ng-click="authorizeRole('1000000')">
<a class="btn btn-app" ng-class="{'isSelect':role=='1000000'}" role="button" ng-click="authorizeRole('1000000')">
<i class="fa fa-line-chart"></i>
Director
</a>
<a class="btn btn-app" role="button" ng-click="authorizeRole('10000000')">
<a class="btn btn-app" ng-class="{'isSelect':role=='10000000'}" role="button" ng-click="authorizeRole('10000000')">
<i class="fa fa-map-o"></i>
Markting
</a>
<a class="btn btn-app" role="button" ng-click="authorizeRole('100000000')">
<a class="btn btn-app" ng-class="{'isSelect':role=='100000000'}" role="button" ng-click="authorizeRole('100000000')">
<i class="fa fa-code"></i>
Developer
</a>
<a class="btn btn-app" role="button" ng-click="authorizeRole('10000000000')">
<a class="btn btn-app" ng-class="{'isSelect':role=='10000000000'}" role="button" ng-click="authorizeRole('10000000000')">
<i class="fa fa-user"></i>
Risk Manager
</a>
<a class="btn btn-app" role="button" ng-click="authorizeRole('100000000000')">
<a class="btn btn-app" ng-class="{'isSelect':role=='100000000000'}" role="button" ng-click="authorizeRole('100000000000')">
<i class="fa fa-tripadvisor"></i>
GUEST
</a>
@ -71,10 +79,29 @@
<!--<i class="fa fa-user-plus"></i>-->
<!--Org Manager-->
<!--</a>-->
<a class="btn btn-app" role="button" ng-click="authorizeRole('10000000000000')">
<a class="btn btn-app" ng-class="{'isSelect':role=='10000000000000'}" role="button" ng-click="authorizeRole('10000000000000')">
<i class="fa fa-ticket"></i>
Sales Manager
</a>
<div class="box box-warning">
<div class="box-header with-border">权限
<button style="float: right;" class="btn btn-success" ng-click="submitAuthorize()">Submit</button>
</div>
<div class="box-body table-responsive">
<div class="row">
<div class="col-sm-4 col-xs-1">
<a role="button" ng-class="{active:mod.module_name==moduleName}" ng-click="switchModule(mod.module_name)" class="list-group-item" ng-repeat="mod in modules.modules" ng-bind="mod.module_name+' - '+mod.remark"></a>
</div>
<div class="col-sm-8 col-xs-1">
<div ng-repeat="mod in modules.modules| filter:filterAuthorized">
<a role="button" class="list-group-item" ng-repeat="func in mod.funcs" ng-bind="func.func_id+(func.remark?'('+func.remark+')':'')"
ng-class="{active:authorized.indexOf(func.func_id)>=0}" ng-click="toggleAuthorize(func)">
</a>
</div>
</div>
</div>
</div>
</div>
<!--<a class="btn btn-app" role="button" ng-click="authorizeRole('100000000000000')">-->
<!--<i class="fa fa-save"></i>-->
<!--Data Content-->

Loading…
Cancel
Save