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 @@
</section>
<section class="panel-body text-center" ng-if="!isRootUser">
<h4>{{'Common.IsRootUserTips' | translate }}</h4>
<h4>{{'Common.IsRootUser' | translate }}</h4>
</section>
</div>
......
server_config_module.controller('ServerConfigController',
['$scope', '$window', '$translate', 'toastr', 'ServerConfigService', 'AppUtil',
function ($scope, $window, $translate, toastr, ServerConfigService, AppUtil) {
['$scope', '$window', '$translate', 'toastr', 'ServerConfigService', 'AppUtil', 'PermissionService',
function ($scope, $window, $translate, toastr, ServerConfigService, AppUtil, PermissionService) {
$scope.serverConfig = {};
$scope.saveBtnDisabled = true;
initPermission();
function initPermission() {
PermissionService.has_root_permission()
.then(function (result) {
$scope.isRootUser = result.hasPermission;
})
}
$scope.create = function () {
ServerConfigService.create($scope.serverConfig).then(function (result) {
toastr.success($translate.instant('ServiceConfig.Saved'));
......
user_module.controller('UserController',
['$scope', '$window', '$translate', 'toastr', 'AppUtil', 'UserService',
['$scope', '$window', '$translate', 'toastr', 'AppUtil', 'UserService', 'PermissionService',
UserController]);
function UserController($scope, $window, $translate, toastr, AppUtil, UserService) {
function UserController($scope, $window, $translate, toastr, AppUtil, UserService, PermissionService) {
$scope.user = {};
initPermission();
function initPermission() {
PermissionService.has_root_permission()
.then(function (result) {
$scope.isRootUser = result.hasPermission;
})
}
$scope.createOrUpdateUser = function () {
UserService.createOrUpdateUser($scope.user).then(function (result) {
toastr.success($translate.instant('UserMange.Created'));
......
......@@ -69,8 +69,10 @@ angular.module('systemRole', ['app.service', 'apollo.directive', 'app.util', 'to
PermissionService.has_root_permission()
.then(function (result) {
$scope.isRootUser = result.hasPermission;
if ($scope.isRootUser) {
getCreateApplicationRoleUsers();
}
});
getCreateApplicationRoleUsers();
}
$scope.getAppInfo = function () {
......
......@@ -16,18 +16,17 @@
<body>
<apollonav></apollonav>
<div class="container-fluid apollo-container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel">
<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">
<header class="panel-heading">
{{'ServiceConfig.Title' | translate }}
<small>{{'ServiceConfig.Tips' | translate }}</small>
</header>
<div class="panel-body">
<form class="form-horizontal" ng-controller="ServerConfigController">
<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
......@@ -73,7 +72,10 @@
</form>
</div>
</div>
</div>
</section>
<section class="panel-body text-center" ng-if="!isRootUser">
<h4>{{'Common.IsRootUser' | translate }}</h4>
</section>
</div>
</div>
......
......@@ -17,20 +17,18 @@
<body>
<apollonav></apollonav>
<div class="container-fluid apollo-container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel">
<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">
<header class="panel-heading">
{{'UserMange.Title' | translate }}
<small>
{{'UserMange.TitleTips' | translate }}
</small>
</header>
<form class="form-horizontal panel-body" name="appForm" ng-controller="UserController"
valdr-type="App" ng-submit="createOrUpdateUser()">
<form class="form-horizontal panel-body" name="appForm"
valdr-type="App" ng-submit="createOrUpdateUser()">
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
......@@ -69,9 +67,11 @@
</div>
</div>
</form>
</div>
</div>
</section>
<section class="panel-body text-center" ng-if="!isRootUser">
<h4>{{'Common.IsRootUser' | translate }}</h4>
</section>
</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