Jelajahi Sumber

修复修改人员,但是未清除缓存,导致数据权限错误

zhouhao 7 tahun lalu
induk
melakukan
00fe00e8ab

+ 0 - 1
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/DefaultPersonnelAuthorizationSupplier.java

@@ -42,7 +42,6 @@ public class DefaultPersonnelAuthorizationSupplier implements PersonnelAuthoriza
         return ThreadLocalUtils.get(threadLocalCacheKey, () ->
                 Authentication.current().map(authentication ->
                         authentication.getAttribute(PersonAttachEntity.personId)
-                                .filter(Objects::nonNull)
                                 .map(String::valueOf)
                                 .map(this::getByPersonId)
                                 .orElseGet(() -> getByUserId(authentication.getUser().getId())))

+ 2 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/src/main/java/org/hswebframework/web/service/organizational/simple/SimplePersonService.java

@@ -103,6 +103,7 @@ public class SimplePersonService extends GenericEntityService<PersonEntity, Stri
     @Caching(evict = {
             @CacheEvict(key = "'id:'+#result"),
             @CacheEvict(key = "'auth:persion-id'+#result"),
+            @CacheEvict(key = "'auth:user-id'+#authBindEntity.userId"),
             @CacheEvict(key = "'auth-bind'+#result"),
             @CacheEvict(key = "'person-name'+#authBindEntity.name")
     })
@@ -122,6 +123,7 @@ public class SimplePersonService extends GenericEntityService<PersonEntity, Stri
     @Caching(evict = {
             @CacheEvict(key = "'id:'+#authBindEntity.id"),
             @CacheEvict(key = "'auth:persion-id'+#authBindEntity.id"),
+            @CacheEvict(key = "'auth:user-id'+#authBindEntity.userId"),
             @CacheEvict(key = "'auth-bind'+#authBindEntity.id"),
             @CacheEvict(key = "'person-name'+#authBindEntity.name")
     })