RANGER-5463: Update userstore version after group-user mapping changes in createOrDeleteXGroupUserList#824
RANGER-5463: Update userstore version after group-user mapping changes in createOrDeleteXGroupUserList#824kimsehwan96 wants to merge 2 commits intoapache:masterfrom
Conversation
…s in createOrDeleteXGroupUserList
| @@ -2964,6 +2964,9 @@ public int createOrDeleteXGroupUserList(List<GroupUserInfo> groupUserInfoList) { | |||
|
|
|||
| updatedGroups = groupUserInfoList.size(); | |||
There was a problem hiding this comment.
Looking at implementation of xGroupUserService.createOrDeleteXGroupUsers(), no update might be performed in some scenarios - depending on contents of parameter groupUserInfo. I suggest updating this method to return true when it performs any update and use that to increment updatedGroups.
There was a problem hiding this comment.
@mneethiraj Changed xGroupUserService.createOrDeleteXGroupUsers() method to return boolean. If the method early returned with no actual updates then return false and If actual update was performed then return true.
And increment updatedGroups and return its count as createOrDeleteGroupUserList return and if at lease one update was really performed then update user store version.
Alos I added test code about it.
There was a problem hiding this comment.
By the way, returning boolean with name createOrDeleteXGroupUsers might be little awkward
There was a problem hiding this comment.
@mneethiraj Can you review this? Thanks.
What changes were proposed in this pull request?
Added missing updateUserStoreVersion() call in XUserMgr.createOrDeleteXGroupUserList().
Without this fix, when user-group membership changes in LDAP (e.g., a user is added to or removed from a group), the
UserSync successfully updates the x_group_users table in Ranger Admin, but the RangerUserStore version remains unchanged.
Other similar methods like createXGroupUserFromMap() and createOrUpdateXGroups() already call updateUserStoreVersion() after modifying user/group data.
How was this patch tested?