refactor: 移除用户认证信息的 perms 字段(接口鉴权根据全局角色权限规则的缓存和用户角色校验)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -48,11 +48,6 @@ public class UserAuthInfo {
|
||||
*/
|
||||
private Set<String> roles;
|
||||
|
||||
/**
|
||||
* 用户拥有的权限集合
|
||||
*/
|
||||
private Set<String> perms;
|
||||
|
||||
/**
|
||||
* 数据权限范围,用于控制用户可以访问的数据级别
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user