You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by ku...@apache.org on 2017/09/08 02:31:55 UTC

zeppelin git commit: [ZEPPELIN-2894] Show users in notebook permission using Shiro JDBC

Repository: zeppelin
Updated Branches:
  refs/heads/master 1e1b95ea1 -> bf7ada0e2


[ZEPPELIN-2894] Show users in notebook permission using Shiro JDBC

### What is this PR for?
Show user list/suggestions in the notebook permission form when using Shiro and JDBC Realm.

### What type of PR is it?
Bug Fix

### What is the Jira issue?
[ZEPPELIN-2894](https://issues.apache.org/jira/browse/ZEPPELIN-2894)

### How should this be tested?
- Shiro with JDBC Realm (e.g. PostgreSQL JDBC Driver)
- Login to any account
- Open Notebook permission form
- Try to get any user suggestion in the dropdown menu by typing an existing name

### Screenshots
**After:**
![userlist_working](https://user-images.githubusercontent.com/1479098/29970688-ccb2fb8c-8f25-11e7-903c-4a917830bc5c.gif)

**Before:**
![userlist_error](https://user-images.githubusercontent.com/1479098/29970676-c13936f4-8f25-11e7-9494-6c0aeb1f383a.gif)

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

Author: janusd <js...@gmail.com>

Closes #2559 from janusd/master and squashes the following commits:

ab84a5ca8 [janusd] [ZEPPELIN-2894] Show user list in notebook permission using Shiro JDBC Realm


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

Branch: refs/heads/master
Commit: bf7ada0e28a830cc7eb9a42874734589a19c3f6b
Parents: 1e1b95e
Author: janusd <js...@gmail.com>
Authored: Fri Sep 1 14:51:48 2017 +0200
Committer: 1ambda <1a...@gmail.com>
Committed: Fri Sep 8 11:31:47 2017 +0900

----------------------------------------------------------------------
 .../src/main/java/org/apache/zeppelin/rest/GetUserList.java      | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/bf7ada0e/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java
index 67d6328..954ee1a 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java
@@ -232,7 +232,7 @@ public class GetUserList {
         return userlist;
       }
 
-      userquery = "select ? from ?";
+      userquery = String.format("SELECT %s FROM %s", username, tablename);
 
     } catch (IllegalAccessException e) {
       LOG.error("Error while accessing dataSource for JDBC Realm", e);
@@ -242,8 +242,6 @@ public class GetUserList {
     try {
       con = dataSource.getConnection();
       ps = con.prepareStatement(userquery);
-      ps.setString(1, username);
-      ps.setString(2, tablename);
       rs = ps.executeQuery();
       while (rs.next()) {
         userlist.add(rs.getString(1).trim());