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/06/28 06:28:26 UTC

[ranger] branch master updated: RANGER-3806: Group's users mapping entry failing whenever primary key auto-increment is not set to 1 in db

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 ef641366b RANGER-3806: Group's users mapping entry failing whenever primary key auto-increment is not set to 1 in db
ef641366b is described below

commit ef641366b861afb7a6451023e6a76ba35aea3f19
Author: pradeep <pr...@apache.org>
AuthorDate: Fri Jun 24 14:49:38 2022 +0530

    RANGER-3806: Group's users mapping entry failing whenever primary key auto-increment is not set to 1 in db
---
 .../src/main/java/org/apache/ranger/service/XGroupUserService.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/security-admin/src/main/java/org/apache/ranger/service/XGroupUserService.java b/security-admin/src/main/java/org/apache/ranger/service/XGroupUserService.java
index 9345e8180..5cfcb785c 100644
--- a/security-admin/src/main/java/org/apache/ranger/service/XGroupUserService.java
+++ b/security-admin/src/main/java/org/apache/ranger/service/XGroupUserService.java
@@ -305,8 +305,11 @@ public class XGroupUserService extends
 					xxGroupUser = new XXGroupUser();
 					groupUserMappingExists = false;
 				}
-				xxGroupUser.setAddedByUserId(createdByUserId);
-				xxGroupUser.setUpdatedByUserId(createdByUserId);
+				XXPortalUser xXPortalUser = daoManager.getXXPortalUser().getById(createdByUserId);
+				if (xXPortalUser != null) {
+					xxGroupUser.setAddedByUserId(createdByUserId);
+					xxGroupUser.setUpdatedByUserId(createdByUserId);
+				}
 
 				if (groupUserMappingExists) {
 					xxGroupUser = getDao().update(xxGroupUser);