Pre Merge pull request !482 from zablo/N/A

This commit is contained in:
zablo 2024-05-13 02:59:34 +00:00 committed by Gitee
commit 0b42ddd247
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 16 additions and 0 deletions

View File

@ -130,6 +130,12 @@ public class SysUserController extends BaseController
@ResponseBody
public AjaxResult addSave(@Validated SysUser user)
{
//检查部门数据权限检测角色权限
deptService.checkDeptDataScope(user.getDeptId());
for (Long roleId :user.getRoleIds()){
roleService.checkRoleDataScope(roleId);
}
if (!userService.checkLoginNameUnique(user))
{
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
@ -189,6 +195,13 @@ public class SysUserController extends BaseController
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
//检查部门数据权限检测角色权限
deptService.checkDeptDataScope(user.getDeptId());
for (Long roleId :user.getRoleIds()){
roleService.checkRoleDataScope(roleId);
}
if (!userService.checkLoginNameUnique(user))
{
return error("修改用户'" + user.getLoginName() + "'失败,登录账号已存在");
@ -259,6 +272,9 @@ public class SysUserController extends BaseController
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
{
userService.checkUserDataScope(userId);
for (Long roleId :roleIds){
roleService.checkRoleDataScope(roleId);
}
userService.insertUserAuth(userId, roleIds);
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return success();