Browse Source

添加Saas申请链接和权限控制

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@1315 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
luoq 10 years ago
parent
commit
e8f6471667

+ 31 - 5
src/main/webapp/resources/js/serve/app.js

@@ -42,7 +42,8 @@ define([ 'toaster', 'ngTable', 'common/services', 'ui.router', 'ui.bootstrap', '
 			templateUrl: "static/tpl/serve/self/client.html"
 		}).state('self.saas',{
 			url: "/saas",
-			templateUrl: "static/tpl/serve/self/saas.html"
+			templateUrl: "static/tpl/serve/self/saas.html",
+			controller: 'SaasCtrl'
 		}).state('self.add',{
 			url: "/add_user",
 			templateUrl: "static/tpl/serve/self/add_user.html",
@@ -401,9 +402,9 @@ define([ 'toaster', 'ngTable', 'common/services', 'ui.router', 'ui.bootstrap', '
 	}]);
 	
 	/*
-	 * 添加用户权限校验
+	 * 添加、注销和绑定用户权限校验
 	 */
-	app.controller('EditUserCtrl',['$scope', 'AuthenticationService', function($scope,AuthenticationService){
+	app.controller('EditUserCtrl',['$scope', 'AuthenticationService', function($scope, AuthenticationService){
 		$scope.sys = true;
 		$scope.editUser  = function(){
 			//已登录
@@ -415,7 +416,7 @@ define([ 'toaster', 'ngTable', 'common/services', 'ui.router', 'ui.bootstrap', '
 						window.location.href="./#/account/user";
 					}
 					else
-						$scope.sys =false;	//非管理员,提示信息
+						$scope.sys =false;	//非管理员,当前页面提示信息
 				});
 			}
 			//未登录
@@ -423,7 +424,32 @@ define([ 'toaster', 'ngTable', 'common/services', 'ui.router', 'ui.bootstrap', '
 				window.location.href="signin#/account/user";
 			}
 		}
-	}]);	
+	}]);
+	
+	/*
+	 * SAAS申请权限校验
+	 */
+	app.controller('SaasCtrl',['$scope', 'AuthenticationService', function($scope,AuthenticationService){
+		$scope.sys = true;
+		$scope.apply  = function(){
+			//已登录
+			if(AuthenticationService.isAuthed()){
+				//获取当前登录用户信息,以判断是否为管理员
+				AuthenticationService.getAuthentication().success(function(data) {
+					$scope.user = data;
+					if($scope.user.sys){	//是管理员,页面跳转
+						window.location.href="./#/account/enterprise";
+					}
+					else
+						$scope.sys =false;	//非管理员,提示信息
+				});
+			}
+			//未登录
+			else{
+				window.location.href="signin#/account/enterprise";
+			}
+		}
+	}]);
 	
 	/**
 	 * 搜索框,回车触发

+ 3 - 2
src/main/webapp/resources/tpl/serve/self/saas.html

@@ -43,8 +43,9 @@
 					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请参照<a href="" style="color:blue;text-decoration:none;">SAAS开通流程图</a>快速开通本服务。
 				</span>
 			</div>
-			<div align="center">
-				<a class="btn btn-success" href="">立即开通SAAS</a>
+			<div align="center" style="margin-bottom:30px;">
+				<span ng-show="!sys" style="color:red; "> 您不是管理员,没有权限申请Saas服务!</span><br>
+				<button class="btn btn-success" ng-click="apply()" ng-disabled="!sys">立即申请SAAS</button><br>
 			</div>
 		</div>
 	</div>