prevent accessing tenant page of non exists tenant 25/52825/1
authorElisha Oren <elisha.oren@hpe.com>
Sun, 22 Jan 2017 11:41:59 +0000 (13:41 +0200)
committerElisha Oren <elisha.oren@hpe.com>
Sun, 5 Mar 2017 12:22:48 +0000 (14:22 +0200)
Change-Id: I62c1f034c4219b9b08cd19a4a263fa832a92cbac
Signed-off-by: Elisha Oren <elisha.oren@hpe.com>
dlux/cpeui/cpeui-module/src/main/resources/cpeui/tenant.controller.js

index c2bb5ab1054254151981991a1931b68783528ad3..8fd8a3c71190782e9cc76169574ce82bd2fbe831 100644 (file)
@@ -26,8 +26,16 @@ define([ 'app/cpeui/cpeui.module' ], function(cpeui) {
       }
     if ($stateParams.tenantTabName in tabIndexs) {
       $scope.tab.tenantData = tabIndexs[$stateParams.tenantTabName];
+    } else {
+        $scope.tab.tenantData = tabIndexs.inventory;
     }
 
+    CpeuiSvc.getTenantList(function(tenant_list) {
+        if (tenant_list.filter(t => t.name == $scope.curTenant).length == 0) {
+            window.location = "#/cpeui/admin/tenants";
+        }
+    });
+
     function init(){
       $scope.updateUnis(function(unis){
         CpeuiSvc.getCes(function(ces) {