You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by pr...@apache.org on 2022/12/01 14:53:00 UTC

[ranger] branch master updated: RANGER-3825: Ranger admin user is unable to change another user email after the upgrade

This is an automated email from the ASF dual-hosted git repository.

pradeep pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/master by this push:
     new 32687a172 RANGER-3825: Ranger admin user is unable to change another user email after the upgrade
32687a172 is described below

commit 32687a172b0da31cf01b285a0123a81dcd7e6da9
Author: pradeep <pr...@apache.org>
AuthorDate: Wed Sep 28 19:27:36 2022 +0530

    RANGER-3825: Ranger admin user is unable to change another user email after the upgrade
---
 security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java b/security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java
index 086c6e5d7..d5393603e 100644
--- a/security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java
@@ -472,9 +472,12 @@ public class UserMgr {
 		} else {
 			String encryptedOldPwd = encrypt(gjUser.getLoginId(), changeEmail.getOldPassword());
 			if (!stringUtil.equals(encryptedOldPwd, gjUser.getPassword())) {
-				logger.info("changeEmailAddress(). Invalid  password. changeEmail=" + changeEmail);
-				throw restErrorUtil.createRESTException("serverMsg.userMgrWrongPassword",
-						MessageEnums.OPER_NO_PERMISSION, null, null, "" + changeEmail);
+				encryptedOldPwd = encryptWithOlderAlgo(gjUser.getLoginId(), changeEmail.getOldPassword());
+				if (!stringUtil.equals(encryptedOldPwd, gjUser.getPassword())) {
+					logger.info("changeEmailAddress(). Invalid  password. changeEmail=" + changeEmail);
+					throw restErrorUtil.createRESTException("serverMsg.userMgrWrongPassword",
+							MessageEnums.OPER_NO_PERMISSION, null, null, "" + changeEmail);
+				}
 			}
 		}