From b7ffb06931acfa0711033e65050e56d11800a3f1 Mon Sep 17 00:00:00 2001 From: astroshim Date: Wed, 28 Dec 2016 21:12:43 -0800 Subject: [PATCH] [ZEPPELIN-1868]fix to not shows up the login button on Anonymous mode. ### What is this PR for? This PR fixs to not shows up the login button on Anonymous mode. ### What type of PR is it? Bug Fix ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-1868 ### How should this be tested? 1. Give permission on note. 2. Turn off the shiro. 3. Delete note that you made on 1. 4. Then you can see the `login button` like as screen shot. ### Screenshots (if appropriate) ![image](https://cloud.githubusercontent.com/assets/3348133/21537257/89d15862-cd43-11e6-8129-0e25348537ae.png) ### Questions: * Does the licenses files need update? no * Is there breaking changes for older versions? no * Does this needs documentation? no Author: astroshim Closes #1813 from astroshim/feat/skipLogin and squashes the following commits: ba72188 [astroshim] fix to not shows up the login button on Anonymous mode. --- .../websocketEvents.factory.js | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js b/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js index ebcaf9a77e6..c3e03347b33 100644 --- a/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js +++ b/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js @@ -69,13 +69,16 @@ } else if (op === 'LIST_UPDATE_NOTE_JOBS') { $rootScope.$broadcast('setUpdateNoteJobs', data.noteRunningJobs); } else if (op === 'AUTH_INFO') { - BootstrapDialog.show({ - closable: false, - closeByBackdrop: false, - closeByKeyboard: false, - title: 'Insufficient privileges', - message: data.info.toString(), - buttons: [{ + var btn = []; + if ($rootScope.ticket.roles === '[]') { + btn = [{ + label: 'Close', + action: function(dialog) { + dialog.close(); + } + }]; + } else { + btn = [{ label: 'Login', action: function(dialog) { dialog.close(); @@ -89,8 +92,18 @@ dialog.close(); $location.path('/'); } - }] + }]; + } + + BootstrapDialog.show({ + closable: false, + closeByBackdrop: false, + closeByKeyboard: false, + title: 'Insufficient privileges', + message: data.info.toString(), + buttons: btn }); + } else if (op === 'PARAGRAPH') { $rootScope.$broadcast('updateParagraph', data); } else if (op === 'PARAGRAPH_APPEND_OUTPUT') {