Pre Merge pull request !431 from 这夏天依然平凡/4.X

This commit is contained in:
这夏天依然平凡 2023-10-10 03:58:54 +00:00 committed by Gitee
commit 234c29bc6d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 8 additions and 5 deletions

View File

@ -10,7 +10,7 @@ public interface UserConstants {
/**
* 平台内系统用户的唯一标志
*/
String SYS_USER = "SYS_USER";
String SYS_USER = "sys_user";
/**
* 正常状态

View File

@ -454,10 +454,13 @@ public class SysRoleServiceImpl implements ISysRoleService {
return;
}
LoginUser loginUser = LoginHelper.getLoginUser(token);
if (ObjectUtil.isNotNull(loginUser) && loginUser.getRoles().stream().anyMatch(r -> r.getRoleId().equals(roleId))) {
try {
StpUtil.logoutByTokenValue(token);
} catch (NotLoginException ignored) {
if (ObjectUtil.isNotNull(loginUser)) {
if (loginUser.getUserType().equals(UserConstants.SYS_USER)
&& loginUser.getRoles().stream().anyMatch(r -> r.getRoleId().equals(roleId))) {
try {
StpUtil.logoutByTokenValue(token);
} catch (NotLoginException ignored) {
}
}
}
});