Commit a5a2c068 authored by Jason Song's avatar Jason Song

add system administrator permission check for user manage and server config page

parent faa09215
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
</section> </section>
<section class="panel-body text-center" ng-if="!isRootUser"> <section class="panel-body text-center" ng-if="!isRootUser">
<h4>{{'Common.IsRootUserTips' | translate }}</h4> <h4>{{'Common.IsRootUser' | translate }}</h4>
</section> </section>
</div> </div>
......
server_config_module.controller('ServerConfigController', server_config_module.controller('ServerConfigController',
['$scope', '$window', '$translate', 'toastr', 'ServerConfigService', 'AppUtil', ['$scope', '$window', '$translate', 'toastr', 'ServerConfigService', 'AppUtil', 'PermissionService',
function ($scope, $window, $translate, toastr, ServerConfigService, AppUtil) { function ($scope, $window, $translate, toastr, ServerConfigService, AppUtil, PermissionService) {
$scope.serverConfig = {}; $scope.serverConfig = {};
$scope.saveBtnDisabled = true; $scope.saveBtnDisabled = true;
initPermission();
function initPermission() {
PermissionService.has_root_permission()
.then(function (result) {
$scope.isRootUser = result.hasPermission;
})
}
$scope.create = function () { $scope.create = function () {
ServerConfigService.create($scope.serverConfig).then(function (result) { ServerConfigService.create($scope.serverConfig).then(function (result) {
toastr.success($translate.instant('ServiceConfig.Saved')); toastr.success($translate.instant('ServiceConfig.Saved'));
......
user_module.controller('UserController', user_module.controller('UserController',
['$scope', '$window', '$translate', 'toastr', 'AppUtil', 'UserService', ['$scope', '$window', '$translate', 'toastr', 'AppUtil', 'UserService', 'PermissionService',
UserController]); UserController]);
function UserController($scope, $window, $translate, toastr, AppUtil, UserService) { function UserController($scope, $window, $translate, toastr, AppUtil, UserService, PermissionService) {
$scope.user = {}; $scope.user = {};
initPermission();
function initPermission() {
PermissionService.has_root_permission()
.then(function (result) {
$scope.isRootUser = result.hasPermission;
})
}
$scope.createOrUpdateUser = function () { $scope.createOrUpdateUser = function () {
UserService.createOrUpdateUser($scope.user).then(function (result) { UserService.createOrUpdateUser($scope.user).then(function (result) {
toastr.success($translate.instant('UserMange.Created')); toastr.success($translate.instant('UserMange.Created'));
......
...@@ -69,9 +69,11 @@ angular.module('systemRole', ['app.service', 'apollo.directive', 'app.util', 'to ...@@ -69,9 +69,11 @@ angular.module('systemRole', ['app.service', 'apollo.directive', 'app.util', 'to
PermissionService.has_root_permission() PermissionService.has_root_permission()
.then(function (result) { .then(function (result) {
$scope.isRootUser = result.hasPermission; $scope.isRootUser = result.hasPermission;
}); if ($scope.isRootUser) {
getCreateApplicationRoleUsers(); getCreateApplicationRoleUsers();
} }
});
}
$scope.getAppInfo = function () { $scope.getAppInfo = function () {
if (!$scope.app.appId) { if (!$scope.app.appId) {
......
...@@ -16,18 +16,17 @@ ...@@ -16,18 +16,17 @@
<body> <body>
<apollonav></apollonav> <apollonav></apollonav>
<div class="container-fluid apollo-container"> <div class="container-fluid apollo-container" ng-controller="ServerConfigController">
<div class="col-md-8 col-md-offset-2 panel">
<section class="panel-body" ng-show="isRootUser">
<div class="row"> <div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel">
<header class="panel-heading"> <header class="panel-heading">
{{'ServiceConfig.Title' | translate }} {{'ServiceConfig.Title' | translate }}
<small>{{'ServiceConfig.Tips' | translate }}</small> <small>{{'ServiceConfig.Tips' | translate }}</small>
</header> </header>
<div class="panel-body"> <div class="panel-body">
<form class="form-horizontal" ng-controller="ServerConfigController"> <form class="form-horizontal">
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label"> <label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield> <apollorequiredfield></apollorequiredfield>
...@@ -73,7 +72,10 @@ ...@@ -73,7 +72,10 @@
</form> </form>
</div> </div>
</div> </div>
</div> </section>
<section class="panel-body text-center" ng-if="!isRootUser">
<h4>{{'Common.IsRootUser' | translate }}</h4>
</section>
</div> </div>
</div> </div>
......
...@@ -17,19 +17,17 @@ ...@@ -17,19 +17,17 @@
<body> <body>
<apollonav></apollonav> <apollonav></apollonav>
<div class="container-fluid apollo-container"> <div class="container-fluid apollo-container" ng-controller="UserController">
<div class="col-md-8 col-md-offset-2 panel">
<section class="panel-body" ng-show="isRootUser">
<div class="row"> <div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel">
<header class="panel-heading"> <header class="panel-heading">
{{'UserMange.Title' | translate }} {{'UserMange.Title' | translate }}
<small> <small>
{{'UserMange.TitleTips' | translate }} {{'UserMange.TitleTips' | translate }}
</small> </small>
</header> </header>
<form class="form-horizontal panel-body" name="appForm"
<form class="form-horizontal panel-body" name="appForm" ng-controller="UserController"
valdr-type="App" ng-submit="createOrUpdateUser()"> valdr-type="App" ng-submit="createOrUpdateUser()">
<div class="form-group" valdr-form-group> <div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label"> <label class="col-sm-2 control-label">
...@@ -69,9 +67,11 @@ ...@@ -69,9 +67,11 @@
</div> </div>
</div> </div>
</form> </form>
</div>
</div> </div>
</section>
<section class="panel-body text-center" ng-if="!isRootUser">
<h4>{{'Common.IsRootUser' | translate }}</h4>
</section>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment