优化权限更新后同步缓存

pull/376/MERGE
RuoYi 4 weeks ago
parent e6796c0954
commit 1899a832b9

@ -27,6 +27,7 @@ import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.InnerAuth;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysDept;
import com.ruoyi.system.api.domain.SysRole;
@ -66,6 +67,9 @@ public class SysUserController extends BaseController
@Autowired
private ISysConfigService configService;
@Autowired
private TokenService tokenService;
/**
*
*/
@ -167,11 +171,17 @@ public class SysUserController extends BaseController
@GetMapping("getInfo")
public AjaxResult getInfo()
{
SysUser user = userService.selectUserById(SecurityUtils.getUserId());
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = loginUser.getSysUser();
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(user);
if (!loginUser.getPermissions().equals(permissions))
{
loginUser.setPermissions(permissions);
tokenService.refreshToken(loginUser);
}
AjaxResult ajax = AjaxResult.success();
ajax.put("user", user);
ajax.put("roles", roles);

Loading…
Cancel
Save