ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rle...@apache.org
Subject [1/2] ambari git commit: Revert "AMBARI-14798. Users cannot login with uppercase username (Oliver Szabo via rlevas)"
Date Tue, 23 Feb 2016 16:14:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e1ca24160 -> 2b42559f5


Revert "AMBARI-14798. Users cannot login with uppercase username (Oliver Szabo via rlevas)"

This reverts commit e1ca24160027d73cf27b90b35bc0757442a0cbdd.


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

Branch: refs/heads/trunk
Commit: f7ebe912b7647caa97b8c28f243d0f8a92f5dfb6
Parents: e1ca241
Author: Robert Levas <rlevas@hortonworks.com>
Authored: Tue Feb 23 11:13:11 2016 -0500
Committer: Robert Levas <rlevas@hortonworks.com>
Committed: Tue Feb 23 11:13:11 2016 -0500

----------------------------------------------------------------------
 .../server/api/services/ActiveWidgetLayoutService.java | 10 +++++++---
 .../server/api/services/UserAuthorizationService.java  |  4 +---
 .../server/api/services/UserPrivilegeService.java      |  3 +--
 .../apache/ambari/server/api/services/UserService.java |  3 +--
 .../api/services/UserAuthorizationServiceTest.java     | 12 ------------
 .../server/api/services/UserPrivilegeServiceTest.java  | 13 -------------
 6 files changed, 10 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f7ebe912/ambari-server/src/main/java/org/apache/ambari/server/api/services/ActiveWidgetLayoutService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ActiveWidgetLayoutService.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ActiveWidgetLayoutService.java
index a0c3386..c4403df 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ActiveWidgetLayoutService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ActiveWidgetLayoutService.java
@@ -17,21 +17,25 @@
  */
 package org.apache.ambari.server.api.services;
 
+import com.sun.jersey.core.util.Base64;
 import org.apache.ambari.server.api.resources.ResourceInstance;
 import org.apache.ambari.server.controller.spi.Resource;
 
+import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
+import javax.ws.rs.POST;
 import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
+import java.nio.charset.Charset;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.commons.lang.StringUtils;
-
 /**
  * WidgetLayout Service
  */
@@ -69,7 +73,7 @@ public class ActiveWidgetLayoutService extends BaseService {
 
   private ResourceInstance createResource(String widgetLayoutId) {
     Map<Resource.Type,String> mapIds = new HashMap<Resource.Type, String>();
-    mapIds.put(Resource.Type.User, StringUtils.lowerCase(userName));
+    mapIds.put(Resource.Type.User, userName);
     return createResource(Resource.Type.ActiveWidgetLayout, mapIds);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f7ebe912/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserAuthorizationService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserAuthorizationService.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserAuthorizationService.java
index c288fdb..6861d3d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserAuthorizationService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserAuthorizationService.java
@@ -32,8 +32,6 @@ import javax.ws.rs.core.UriInfo;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.commons.lang.StringUtils;
-
 /**
  * UserAuthorizationService is a read-only service responsible for user authorization resource
requests.
  * <p/>
@@ -96,7 +94,7 @@ public class UserAuthorizationService extends BaseService {
    */
   protected ResourceInstance createAuthorizationResource(String authorizationId) {
     Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
-    mapIds.put(Resource.Type.User, StringUtils.lowerCase(username));
+    mapIds.put(Resource.Type.User, username);
     mapIds.put(Resource.Type.UserAuthorization, authorizationId);
     return createResource(Resource.Type.UserAuthorization, mapIds);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f7ebe912/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserPrivilegeService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserPrivilegeService.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserPrivilegeService.java
index 86c4995..80769cf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserPrivilegeService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserPrivilegeService.java
@@ -29,7 +29,6 @@ import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
-import org.apache.commons.lang.StringUtils;
 /**
  *  Service responsible for user privilege resource requests.
  */
@@ -73,7 +72,7 @@ public class UserPrivilegeService extends PrivilegeService {
   @Override
   protected ResourceInstance createPrivilegeResource(String privilegeId) {
     final Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
-    mapIds.put(Resource.Type.User, StringUtils.lowerCase(userName));
+    mapIds.put(Resource.Type.User, userName);
     mapIds.put(Resource.Type.UserPrivilege, privilegeId);
     return createResource(Resource.Type.UserPrivilege, mapIds);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f7ebe912/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
index c46c373..fea5eca 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
@@ -31,7 +31,6 @@ import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
 import org.apache.ambari.server.controller.spi.Resource;
-
 import org.apache.commons.lang.StringUtils;
 
 import java.util.Collections;
@@ -172,6 +171,6 @@ public class UserService extends BaseService {
    */
   private ResourceInstance createUserResource(String userName) {
     return createResource(Resource.Type.User,
-        Collections.singletonMap(Resource.Type.User, StringUtils.lowerCase(userName)));
+        Collections.singletonMap(Resource.Type.User, userName));
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f7ebe912/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserAuthorizationServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserAuthorizationServiceTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserAuthorizationServiceTest.java
index c3270bb..9627d19 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserAuthorizationServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserAuthorizationServiceTest.java
@@ -21,8 +21,6 @@ package org.apache.ambari.server.api.services;
 import org.apache.ambari.server.api.resources.ResourceInstance;
 import org.apache.ambari.server.api.services.parsers.RequestBodyParser;
 import org.apache.ambari.server.api.services.serializers.ResultSerializer;
-import org.apache.ambari.server.controller.spi.Resource;
-import org.junit.Test;
 
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.UriInfo;
@@ -56,16 +54,6 @@ public class UserAuthorizationServiceTest extends BaseServiceTest {
     return listInvocations;
   }
 
-  @Test
-  public void testCreateAuthorizationResourceWithUppercaseUsername() {
-    // GIVEN
-    UserAuthorizationService userAuthorizationService= new UserAuthorizationService("Jdoe");
-    // WHEN
-    ResourceInstance result = userAuthorizationService.createAuthorizationResource("id");
-    // THEN
-    assertEquals("jdoe", result.getKeyValueMap().get(Resource.Type.User));
-  }
-
 
   private class TestUserAuthorizationService extends UserAuthorizationService {
     private String id;

http://git-wip-us.apache.org/repos/asf/ambari/blob/f7ebe912/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserPrivilegeServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserPrivilegeServiceTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserPrivilegeServiceTest.java
index db2d38a..269315a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserPrivilegeServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserPrivilegeServiceTest.java
@@ -33,13 +33,10 @@ import junit.framework.Assert;
 import org.apache.ambari.server.api.resources.ResourceInstance;
 import org.apache.ambari.server.api.services.parsers.RequestBodyParser;
 import org.apache.ambari.server.api.services.serializers.ResultSerializer;
-import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.Resource.Type;
 import org.easymock.EasyMock;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-
 /**
  * Unit tests for GroupService.
  */
@@ -85,16 +82,6 @@ public class UserPrivilegeServiceTest extends BaseServiceTest {
     }
   }
 
-  @Test
-  public void testCreatePrivilegeResourcesWithUppercaseUsername() {
-    // GIVEN
-    UserPrivilegeService userPrivilegeService = new UserPrivilegeService("User");
-    // WHEN
-    ResourceInstance result = userPrivilegeService.createPrivilegeResource("test");
-    // THEN
-    assertEquals( "user", result.getKeyValueMap().get(Resource.Type.User));
-  }
-
   private class TestUserPrivilegeService extends UserPrivilegeService {
 
     public TestUserPrivilegeService() {


Mime
View raw message