Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master 98c00eb7d -> 0e719dff5


Fixing Zeppelin-838: Minor improvement to error message

### What is this PR for?
This JIRA improves the error message displayed when the current user opens a 
notebook to which the user is not allowed access to.

### What type of PR is it?
[Minor Improvement ]

### Todos
* None

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

### How should this be tested?
Get the change in this pull request. Build Zeppelin, configure shiro 
authentication by commenting out the 1st line below and modifying the 
corresponding line for 2nd line.
#/** = anon
/** = authcBasic
Log in as user1, configure a notebook to only allow access to only user1, now 
access that same notebook as  user2 and note the new error message.

### Screenshots (if appropriate)

[Screenshot:-Before](https://issues.apache.org/jira/secure/attachment/12802057/Screen%20Shot%202016-05-03%20at%203.16.58%20PM.png)
[Screenshot:-After](https://issues.apache.org/jira/secure/attachment/12802065/Screen%20Shot%202016-05-03%20at%203.17.36%20PM.png)

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

Author: Vinay Shukla <[email protected]>

Closes #872 from vinayshukla/zeppelin-838 and squashes the following commits:

ce4b3bd [Vinay Shukla] Fixing Zeppelin-838: Minor improvement to error message


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

Branch: refs/heads/master
Commit: 0e719dff54e2397b94a7a2011331646ad4094fbc
Parents: 98c00eb
Author: Vinay Shukla <[email protected]>
Authored: Tue May 3 15:39:25 2016 -0700
Committer: Prabhjyot Singh <[email protected]>
Committed: Thu May 19 10:55:31 2016 +0530

----------------------------------------------------------------------
 .../org/apache/zeppelin/socket/NotebookServer.java     | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/0e719dff/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java 
b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
index 9e46cd2..52fd740 100644
--- 
a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
+++ 
b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
@@ -399,14 +399,17 @@ public class NotebookServer extends WebSocketServlet 
implements
     broadcastAll(new Message(OP.NOTES_INFO).put("notes", notesInfo));
   }
 
-  void permissionError(NotebookSocket conn, String op, Set<String> current,
-                      Set<String> allowed) throws IOException {
+  void permissionError(NotebookSocket conn, String op, Set<String> 
userAndRoles,
+                       Set<String> allowed) throws IOException {
     LOG.info("Cannot {}. Connection readers {}. Allowed readers {}",
-            op, current, allowed);
+            op, userAndRoles, allowed);
+
+    String userName = userAndRoles.iterator().next();
+
     conn.send(serializeMessage(new Message(OP.AUTH_INFO).put("info",
-            "Insufficient privileges to " + op + " note.\n\n" +
+            "Insufficient privileges to " + op + " notebook.\n\n" +
                     "Allowed users or roles: " + allowed.toString() + "\n\n" +
-                    "User belongs to: " + current.toString())));
+                    "But the user " + userName + " belongs to: " + 
userAndRoles.toString())));
   }
 
   private void sendNote(NotebookSocket conn, HashSet<String> userAndRoles, 
Notebook notebook,

Reply via email to