-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/52500/
-----------------------------------------------------------

(Updated Oct. 4, 2016, 1:14 p.m.)


Review request for Ambari, Mahadev Konar, Robert Levas, and Sumit Mohanty.


Changes
-------

1. Return the usernames as-is in the GET request
2. When a specific user is requested using 
http://localhost:8080/api/v1/users/<username>, irrespective of the case, if 
there is a match, the username will be returned as-is.
3. Made changes to the predicate evaluator to support (2).
4. Verified the changes with additional manual tests.


Bugs: AMBARI-18520
    https://issues.apache.org/jira/browse/AMBARI-18520


Repository: ambari


Description
-------

AMBARI-18520: Ambari usernames should not be converted to lowercase before 
storing in the DB.


Diffs (updated)
-----

  
ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
 c46c373e56294b76360706afc802a1124e5b304b 
  
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
 0324d380660aa0872f493da1c25a31259a9fdfcd 
  
ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/ComparisonPredicate.java
 a36f0fb074404727b45c11fc9613ff64475cbf1c 
  
ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/EqualsPredicate.java
 64f5c6fc94719ba86522c874efe9540a25b765c3 
  
ambari-server/src/main/java/org/apache/ambari/server/security/authorization/User.java
 85104fc5d68f6ff8c32b9b17a708bb2018fe97d5 
  
ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
 e547f058d4270bedf8b10f68311232488d26a7ea 
  
ambari-server/src/test/java/org/apache/ambari/server/api/services/UserServiceTest.java
 0ed0a6657c55013f16d55edac531c46bea580b3d 
  
ambari-server/src/test/java/org/apache/ambari/server/security/SecurityHelperImplTest.java
 a4bd6c15033146d6b65f77e2801518316b6503bc 
  
ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariUserAuthenticationFilterTest.java
 fda31887d53598f54d1ac2557a7a653f21bb1b85 
  
ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
 cdbe7b5ba1a1ebbb2a0c28340019b71c93ef418e 

Diff: https://reviews.apache.org/r/52500/diff/


Testing (updated)
-------

** 1. mvn test -DskipPythonTests 
-Dtest=SecurityHelperImplTest,*User*Test,UpgradeCatalog240Test **

Results :

Tests run: 108, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:13.360s
[INFO] Finished at: Tue Oct 04 13:05:35 PDT 2016
[INFO] Final Memory: 58M/873M
[INFO] ------------------------------------------------------------------------

** 2. Manual tests **

Set up a one node cluster with the latest build from trunk and replaced 
ambari-server JAR with the one from the local build.
1. Create a user ABCD. Was able to create the user successfully.

2. Create a user *abcd*. Unable to create the user. Got the following error 
message:
    User creation error
    An internal system exception occurred: User ABCD already exists
    
3. curl -u admin:admin -H "X-Requested-By: ambari" -X GET 
http://localhost:8080/api/v1/users/abcd

{
  "href" : "http://localhost:8080/api/v1/users/abcd";,
  "Users" : {
    "active" : true,
    "admin" : false,
    "groups" : [ ],
    "ldap_user" : false,
    "user_name" : "ABCD",
    "user_type" : "LOCAL"
  },
  "privileges" : [ ],
  "widget_layouts" : [ ]
}

curl -u admin:admin -H "X-Requested-By: ambari" -X GET 
http://localhost:8080/api/v1/users/ABCD

{
  "href" : "http://localhost:8080/api/v1/users/ABCD";,
  "Users" : {
    "active" : true,
    "admin" : false,
    "groups" : [ ],
    "ldap_user" : false,
    "user_name" : "ABCD",
    "user_type" : "LOCAL"
  },
  "privileges" : [ ],
  "widget_layouts" : [ ]
}

curl -u admin:admin -H "X-Requested-By: ambari" -X GET 
http://localhost:8080/api/v1/users/
{
  "href" : "http://localhost:8080/api/v1/users/";,
  "items" : [
    {
      "href" : "http://localhost:8080/api/v1/users/ABCD";,
      "Users" : {
        "user_name" : "ABCD"
      }
    },
    {
      "href" : "http://localhost:8080/api/v1/users/ADMIN";,
      "Users" : {
        "user_name" : "ADMIN"
      }
    }
  ]
}


Thanks,

Nahappan Somasundaram

Reply via email to