用户管理

This commit is contained in:
cwchen 2024-06-28 17:36:16 +08:00
parent 50dbaf00d1
commit 5c1a0c498a
4 changed files with 8 additions and 7 deletions

View File

@ -105,7 +105,7 @@ public class SysRoleController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysRole role) public AjaxResult edit(@Validated @RequestBody SysRole role)
{ {
// roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId()); roleService.checkRoleDataScope(role.getRoleId());
if (!roleService.checkRoleNameUnique(role)) if (!roleService.checkRoleNameUnique(role))
{ {

View File

@ -182,7 +182,8 @@ public class SysUserController extends BaseController
userService.checkUserDataScope(userId); userService.checkUserDataScope(userId);
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
List<SysRole> roles = roleService.selectRoleAll(); List<SysRole> roles = roleService.selectRoleAll();
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); ajax.put("roles", roles);
// ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("posts", postService.selectPostAll()); ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId)) if (StringUtils.isNotNull(userId))
{ {

View File

@ -65,8 +65,8 @@ public class SysMenuServiceImpl implements ISysMenuService
@Override @Override
public List<SysMenu> selectMenuList(SysMenu menu, Long userId) public List<SysMenu> selectMenuList(SysMenu menu, Long userId)
{ {
List<SysMenu> menuList = null; List<SysMenu> menuList = menuMapper.selectMenuList(menu);
// 管理员显示所有菜单信息 /*// 管理员显示所有菜单信息
if (SysUser.isAdmin(userId)) if (SysUser.isAdmin(userId))
{ {
menuList = menuMapper.selectMenuList(menu); menuList = menuMapper.selectMenuList(menu);
@ -75,7 +75,7 @@ public class SysMenuServiceImpl implements ISysMenuService
{ {
menu.getParams().put("userId", userId); menu.getParams().put("userId", userId);
menuList = menuMapper.selectMenuListByUserId(menu); menuList = menuMapper.selectMenuListByUserId(menu);
} }*/
return menuList; return menuList;
} }

View File

@ -224,10 +224,10 @@ public class SysUserServiceImpl implements ISysUserService
@Override @Override
public void checkUserAllowed(SysUser user) public void checkUserAllowed(SysUser user)
{ {
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) /*if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin())
{ {
throw new ServiceException("不允许操作超级管理员用户"); throw new ServiceException("不允许操作超级管理员用户");
} }*/
} }
/** /**