fix(安全问题): 修复该接口返回密码信息的Bug

This commit is contained in:
OTTO 2024-07-26 17:19:12 +08:00
parent 129e36a830
commit 61fab7489f
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package com.microservices.system.controller;
import com.microservices.common.core.domain.R;
import com.microservices.common.core.exception.ServiceException;
import com.microservices.common.core.utils.StringUtils;
import com.microservices.common.core.utils.poi.ExcelUtil;
import com.microservices.common.core.web.controller.BaseController;
@ -238,8 +239,12 @@ public class SysUserController extends BaseController {
*/
@GetMapping("getInfo")
public AjaxResult getInfo() {
SysUser user = userService.selectUserById(SecurityUtils.getUserId());
SysUserDeptRole userIdentity = SecurityUtils.getUserIdentity();
if (userIdentity == null) {
throw new ServiceException("当前组织不存在或无权限访问");
}
SysUser user = userService.selectUserById(SecurityUtils.getUserId());
user.setPassword(null);
// 角色集合
Set<String> roles = tokenService.getRolePermissions();
// 权限集合