refactor: 移除用户认证信息的 perms 字段(接口鉴权根据全局角色权限规则的缓存和用户角色校验)

This commit is contained in:
Ray.Hao
2024-12-06 17:31:21 +08:00
parent e9afa3f817
commit c56d417dbe
3 changed files with 0 additions and 18 deletions

View File

@@ -36,8 +36,6 @@ public class SysUserDetails implements UserDetails {
private Collection<SimpleGrantedAuthority> authorities;
private Set<String> perms;
private Long deptId;
private Integer dataScope;
@@ -57,7 +55,6 @@ public class SysUserDetails implements UserDetails {
this.username = user.getUsername();
this.password = user.getPassword();
this.enabled = ObjectUtil.equal(user.getStatus(), 1);
this.perms = user.getPerms();
this.deptId = user.getDeptId();
this.dataScope = user.getDataScope();
}

View File

@@ -48,11 +48,6 @@ public class UserAuthInfo {
*/
private Set<String> roles;
/**
* 用户拥有的权限集合
*/
private Set<String> perms;
/**
* 数据权限范围,用于控制用户可以访问的数据级别
*

View File

@@ -202,11 +202,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
UserAuthInfo userAuthInfo = this.baseMapper.getUserAuthInfo(username);
if (userAuthInfo != null) {
Set<String> roles = userAuthInfo.getRoles();
if (CollectionUtil.isNotEmpty(roles)) {
Set<String> perms = roleMenuService.getRolePermsByRoleCodes(roles);
userAuthInfo.setPerms(perms);
}
// 获取最大范围的数据权限
Integer dataScope = roleService.getMaximumDataScope(roles);
userAuthInfo.setDataScope(dataScope);
@@ -226,11 +221,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
UserAuthInfo userAuthInfo = this.baseMapper.getUserAuthInfoByOpenId(openid);
if (userAuthInfo != null) {
Set<String> roles = userAuthInfo.getRoles();
if (CollectionUtil.isNotEmpty(roles)) {
Set<String> perms = roleMenuService.getRolePermsByRoleCodes(roles);
userAuthInfo.setPerms(perms);
}
// 获取最大范围的数据权限
Integer dataScope = roleService.getMaximumDataScope(roles);
userAuthInfo.setDataScope(dataScope);