zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cornead...@apache.org
Subject zeppelin git commit: Block all routes except Home when user isn't logged
Date Wed, 13 Jul 2016 06:22:03 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/master 6bd4ede7e -> 9ce24e24b


Block all routes except Home when user isn't logged

### What is this PR for?
When user isn't logged while the auth is activated, we are hiding the notebooks and most of
the menus.
However you can still access them using the url routes.
This PR is blocking the url routes except the home route ('/') in that case.

### What type of PR is it?
Improvement

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1123

### How should this be tested?
* Activate the auth in shiro.ini
* Launch Zeppelin, and try to visit `localhost:8080/#/interpreter` by typing it in your browser
* You should be redirected to '/'

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: Damien CORNEAU <corneadoug@gmail.com>

Closes #1153 from corneadoug/ZEPPELIN-1123 and squashes the following commits:

58c5a6e [Damien CORNEAU] Remove preventDefault
ebb9136 [Damien CORNEAU] Block all routes except Home when user isn't logged


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/9ce24e24
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/9ce24e24
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/9ce24e24

Branch: refs/heads/master
Commit: 9ce24e24b1d5033a97e2c9201d2584e3385cd938
Parents: 6bd4ede
Author: Damien CORNEAU <corneadoug@gmail.com>
Authored: Mon Jul 11 16:02:34 2016 +0900
Committer: Damien CORNEAU <corneadoug@gmail.com>
Committed: Wed Jul 13 15:21:47 2016 +0900

----------------------------------------------------------------------
 zeppelin-web/src/app/app.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/9ce24e24/zeppelin-web/src/app/app.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/app.js b/zeppelin-web/src/app/app.js
index 3cbfe3f..98d6b87 100644
--- a/zeppelin-web/src/app/app.js
+++ b/zeppelin-web/src/app/app.js
@@ -98,7 +98,6 @@
     var baseUrlSrv = angular.injector(['zeppelinWebApp']).get('baseUrlSrv');
     // withCredentials when running locally via grunt
     $http.defaults.withCredentials = true;
-
     return $http.get(baseUrlSrv.getRestApiBase() + '/security/ticket').then(function(response)
{
       zeppelinWebApp.run(function($rootScope) {
         $rootScope.ticket = angular.fromJson(response.data).body;
@@ -109,11 +108,17 @@
   }
 
   function bootstrapApplication() {
+    zeppelinWebApp.run(function($rootScope, $location) {
+      $rootScope.$on('$routeChangeStart', function(event, next, current) {
+        if (!$rootScope.ticket && next.$$route && !next.$$route.publicAccess)
{
+          $location.path('/');
+        }
+      });
+    });
     angular.bootstrap(document, ['zeppelinWebApp']);
   }
 
   angular.element(document).ready(function() {
     auth().then(bootstrapApplication);
   });
-
 }());


Mime
View raw message