ranger-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pradeep Agrawal <pradeep.agra...@freestoneinfotech.com>
Subject Review Request 47812: RANGER-899 : emailchange REST API and junit fix
Date Wed, 25 May 2016 09:21:19 GMT

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

Review request for ranger, Alok Lal, Don Bosco Durai, Gautam Borad, Abhay Kulkarni, Madhan
Neethiraj, Ramesh Mani, Selvamohan Neethiraj, and Velmurugan Periasamy.


Bugs: RANGER-899
    https://issues.apache.org/jira/browse/RANGER-899


Repository: ranger


Description
-------

**Problem Statement:**
REST API 'service/users/{id}/emailChange' to change email address is not working properly,
currently its working only when existing email address is null in DB.

**Proposed Solution:**
Removed condition which was throwing exception when existing email address is not null. Added
condition to make sure new email address should not be null or empty.

Updated junit test cases related to UserMgr.changeEmailAddress()


Diffs
-----

  agents-audit/src/main/java/org/apache/ranger/audit/provider/AuditProviderFactory.java b95e2a9

  security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java 0e042fe 
  security-admin/src/test/java/org/apache/ranger/audit/TestAuditQueue.java 3fe6246 
  security-admin/src/test/java/org/apache/ranger/biz/TestUserMgr.java 2506c03 
  security-admin/src/test/java/org/apache/ranger/common/TestDateUtil.java a55bbdf 
  security-admin/src/test/java/org/apache/ranger/common/TestStringUtil.java 044aebb 

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


Testing
-------

**Steps Performed:**
1. Created 'testuser1' with email address 'testuser1@test.com' from Ranger UI.
2. Executed below given curl command from console to change email address of 'testuser1' to
'testuser1@apache.org' 
curl -i -u testuser1:user1234  --header "Accept:application/json" -H "Content-Type:application/json"
-X POST http://localhost:6080/service/users/5/emailchange -d '{"loginId":"testuser1", "emailAddress":"testuser1@apache.org",
"oldPassword":"user1234"}'
**Expected Behaviour :** email address of 'testuser1' should get change to 'testuser1@apache.org'
**Actual Behaviour :** Received below given response after curl command and email address
of 'testuser1' was changed in x_portal_user table and new email address was seen in email
address column of user list at user page of Ranger admin UI.
*Response :* {"id":5,"createDate":null,"updateDate":null,"loginId":"testuser1","status":1,"emailAddress":"testuser1@apache.org","firstName":"testuser1","lastName":"user1234","publicScreenName":"testuser1
user1234","userSource":0,"userRoleList":["ROLE_USER"],"userPermList":[{"id":19,"createDate":"2016-05-25T08:39:54Z","updateDate":"2016-05-25T08:39:54Z","owner":"Admin","updatedBy":"Admin","userId":5,"moduleId":1,"isAllowed":1,"userName":"testuser1","moduleName":"Resource
Based Policies"},{"id":20,"createDate":"2016-05-25T08:39:54Z","updateDate":"2016-05-25T08:39:54Z","owner":"Admin","updatedBy":"Admin","userId":5,"moduleId":3,"isAllowed":1,"userName":"testuser1","moduleName":"Reports"}],"groupPermissions":[]}


Thanks,

Pradeep Agrawal


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message