修复新增操作权限不生效BUG
This commit is contained in:
parent
25c9b7e028
commit
3c9d81056b
|
|
@ -91,11 +91,17 @@ public class SaTokenRedis {
|
||||||
clearPermissionCache(group);
|
clearPermissionCache(group);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Long size = stringRedisTemplate.opsForList().size(USER_PERMISSION_KEY + ":" + group);
|
List<String> oldPermissionList = stringRedisTemplate.opsForList().range(USER_PERMISSION_KEY + ":" + group, 0, -1);
|
||||||
if(size != null && size > 0) {
|
if(oldPermissionList == null || oldPermissionList.isEmpty()) {
|
||||||
return; // 如果存在就不添加了,要求必须调用清除方法后在调用这个
|
stringRedisTemplate.opsForList().rightPushAll(USER_PERMISSION_KEY + ":" + group, permissionList);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
stringRedisTemplate.opsForList().rightPushAll(USER_PERMISSION_KEY + ":" + group, permissionList);
|
for (String permission : permissionList) {
|
||||||
|
if(!oldPermissionList.contains(permission)) {
|
||||||
|
stringRedisTemplate.opsForList().rightPush(USER_PERMISSION_KEY + ":" + group, permission);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user