Skip to content

[Bug] [Module Name] Version 1.2.4: When updating the role menu, if other roles also have the same menu, all menu permissions of other roles will be deleted #4485

@hzt514

Description

@hzt514

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

RoleMenuServiceImpl 类
// if not empty , delete all role menus
if (CollUtil.isNotEmpty(roleMenus)) {
roleMenus.forEach(rm -> {
getBaseMapper().delete(new LambdaQueryWrapper().eq(RoleMenu::getMenuId, rm.getMenuId()));
});
}
给角色授权菜单的逻辑里删除角色菜单只匹配菜单id,会把其他角色同样配置了相同菜单的全删了

What you expected to happen

// if not empty , delete all role menus
if (CollUtil.isNotEmpty(roleMenus)) {
roleMenus.forEach(rm -> {
getBaseMapper().delete(new LambdaQueryWrapper().eq(RoleMenu::getMenuId, rm.getMenuId())
.eq(RoleMenu::getRoleId, rm.getRoleId())); //修复bug,添加菜单角色id过滤,避免删除其他角色相同菜单id
});
}

How to reproduce

更新角色菜单时,如果其他角色也有相同的菜单,会把其他角色的菜单权限全删了

Anything else

No response

Version

1.2.3

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingWaiting for replyWaiting for reply

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions