|
@@ -53,14 +53,16 @@ public class UserAuthService {
|
|
|
if (!redisService.hasKey(RedisCacheConstant.USER_ROLE_KEY_PRE+StpUtil.getLoginId())) {
|
|
|
// 这里从更改用户角色的地方修改最好
|
|
|
// redisService.deleteObject(RedisCacheConstant.USER_ROLE_KEY_PRE+StpUtil.getLoginId());
|
|
|
- redisService.set(RedisCacheConstant.USER_ROLE_KEY_PRE+ StpUtil.getLoginId(), roleCodeSet);
|
|
|
+ redisService.sAdd(RedisCacheConstant.USER_ROLE_KEY_PRE+ StpUtil.getLoginId(), roleCodeSet.toArray());
|
|
|
}
|
|
|
for (String roleCode : roleCodeSet) {
|
|
|
if (!redisService.hasKey(RedisCacheConstant.ROLE_PERM_KEY_PRE+roleCode)) {
|
|
|
// 这里从更改角色权限的地方修改最好
|
|
|
// redisService.deleteObject(RedisCacheConstant.ROLE_PERM_KEY_PRE+roleCode);
|
|
|
Set<String> permCodeSet = this.getPermCodeSet(roleCode);
|
|
|
- redisService.set(RedisCacheConstant.ROLE_PERM_KEY_PRE+roleCode, permCodeSet);
|
|
|
+ if (!CollectionUtils.isEmpty(permCodeSet)) {
|
|
|
+ redisService.sAdd(RedisCacheConstant.ROLE_PERM_KEY_PRE+roleCode, permCodeSet.toArray());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|