Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,11 @@ public void updatePermissionRoleMapping(UpdatePermissionRoleMappingDto dto, User
}
});

biConsumer.accept(dto.getAdds(), (permissions, addRoleMappingDtos, roleId) -> {
biConsumer.accept(dto.getAdds(), (permissions, wholeRoleMappingDtos, roleId) -> {
// 只添加用户指定的权限,不自动添加子权限
List<RoleMappingDto> addRoleMappingDtos = dto.getAdds().stream()
.filter(r -> r.getRoleId().equals(roleId))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r.getRoleId().equals(roleId) can throw an NPE if any incoming RoleMappingDto has a null roleId (and it would be grouped under a null roleId as well). Consider making this role-id comparison null-safe to avoid a hard failure on unexpected/invalid input.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(addRoleMappingDtos)) {
//去重
List<Criteria> queryExistsCriteriaList = addRoleMappingDtos.stream()
Expand Down
Loading