You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by rk...@apache.org on 2018/04/25 09:05:57 UTC

zeppelin git commit: [HOTFIX] ZEPPELIN-3405 fix permission checks with roles

Repository: zeppelin
Updated Branches:
  refs/heads/master 0a47b1393 -> ad77265c6


[HOTFIX] ZEPPELIN-3405 fix permission checks with roles

hotfix for #2931
https://github.com/apache/zeppelin/pull/2931#issuecomment-383736331

[Hot Fix]

* [ ] - Task

https://issues.apache.org/jira/browse/ZEPPELIN-3405

see PR description

* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: Renjith Kamath <rk...@apache.org>

Closes #2942 from r-kamath/hotfix_ZEPPELIN-3405 and squashes the following commits:

b93c2de93 [Renjith Kamath] ZEPPELIN-3405 fix permission checks with roles

Change-Id: I1ce0d0306dc665b0267042a5e9181a13f136fac1


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

Branch: refs/heads/master
Commit: ad77265c69bf2ea5fe82fa8c15c7a3d3ea2178e3
Parents: 0a47b13
Author: Renjith Kamath <rk...@apache.org>
Authored: Tue Apr 24 16:47:44 2018 +0530
Committer: Renjith Kamath <rk...@apache.org>
Committed: Wed Apr 25 14:35:44 2018 +0530

----------------------------------------------------------------------
 .../java/org/apache/zeppelin/user/AuthenticationInfo.java    | 8 +-------
 .../org/apache/zeppelin/user/AuthenticationInfoTest.java     | 2 +-
 2 files changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/ad77265c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/AuthenticationInfo.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/AuthenticationInfo.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/AuthenticationInfo.java
index fe9cba6..c9412cb 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/AuthenticationInfo.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/AuthenticationInfo.java
@@ -57,13 +57,7 @@ public class AuthenticationInfo implements JsonSerializable {
   public AuthenticationInfo(String user, String roles, String ticket) {
     this.user = user;
     this.ticket = ticket;
-    if (StringUtils.isNotBlank(roles) && roles.length() > 2) {
-      this.roles = new ArrayList<>();
-      for (final String role : roles.substring(1, roles.length() - 1)
-          .split(",")) {
-        this.roles.add(role.trim());
-      }
-    }
+    this.roles = gson.fromJson(roles, ArrayList.class);
   }
 
   public String getUser() {

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/ad77265c/zeppelin-interpreter/src/test/java/org/apache/zeppelin/user/AuthenticationInfoTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/user/AuthenticationInfoTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/user/AuthenticationInfoTest.java
index a13d91a..b757033 100644
--- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/user/AuthenticationInfoTest.java
+++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/user/AuthenticationInfoTest.java
@@ -28,7 +28,7 @@ public class AuthenticationInfoTest {
 
   @Test
   public void testRoles() {
-    final String roles = "[role1, role2, role with space]";
+    final String roles = "[\"role1\", \"role2\", \"role with space\"]";
 
     final AuthenticationInfo authenticationInfo = new AuthenticationInfo("foo",
         roles, "bar");