Skip to content

Commit d7e6db4

Browse files
pradeepagrawal8184mneethiraj
authored andcommitted
RANGER-3806: Group's users mapping entry failing whenever primary key auto-increment is not set to 1 in db
(cherry picked from commit ef64136)
1 parent 9261b6e commit d7e6db4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

security-admin/src/main/java/org/apache/ranger/service/XGroupUserService.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,11 @@ private void updateGroupUserMappings() {
305305
xxGroupUser = new XXGroupUser();
306306
groupUserMappingExists = false;
307307
}
308-
xxGroupUser.setAddedByUserId(createdByUserId);
309-
xxGroupUser.setUpdatedByUserId(createdByUserId);
308+
XXPortalUser xXPortalUser = daoManager.getXXPortalUser().getById(createdByUserId);
309+
if (xXPortalUser != null) {
310+
xxGroupUser.setAddedByUserId(createdByUserId);
311+
xxGroupUser.setUpdatedByUserId(createdByUserId);
312+
}
310313

311314
if (groupUserMappingExists) {
312315
xxGroupUser = getDao().update(xxGroupUser);

0 commit comments

Comments
 (0)