From f1a2e77676e4fefe73b3c00b6ed31ca1038b55bc Mon Sep 17 00:00:00 2001 From: yixian Date: Thu, 10 Sep 2020 22:38:40 +1000 Subject: [PATCH] bug fix: sync functions clear all records --- .../sysconfig/core/impls/PermissionManagerImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionManagerImpl.java index 2f75d45cc..120715e69 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionManagerImpl.java @@ -28,7 +28,9 @@ public class PermissionManagerImpl implements PermissionManager { private PermissionModuleMapper permissionModuleMapper; @Resource private PermissionReader permissionReader; + @Override + @Transactional public void synchronizeFunctions() { List functions = permissionFunctionMapper.listAll(); Map funcMapFromDB = new HashMap<>(); @@ -40,7 +42,7 @@ public class PermissionManagerImpl implements PermissionManager { for (PermissionNode node : nodes) { String funcId = node.getFuncId(); if (funcMapFromDB.containsKey(funcId.toLowerCase())) { - funcMapFromDB.remove(funcId); + funcMapFromDB.remove(funcId.toLowerCase()); JSONObject func = node.initFuncObject(); func.remove("role"); permissionFunctionMapper.update(func); @@ -142,7 +144,7 @@ public class PermissionManagerImpl implements PermissionManager { } @Override - @CacheEvict(value = ":login:managers:",allEntries = true) + @CacheEvict(value = ":login:managers:", allEntries = true) public void setFunctionModule(String funcId, String moduleName) { if (moduleName == null) { throw new BadRequestException("module name not provided"); @@ -169,7 +171,7 @@ public class PermissionManagerImpl implements PermissionManager { @Override @Transactional - @CacheEvict(value = ":login:managers:",allEntries = true) + @CacheEvict(value = ":login:managers:", allEntries = true) public void authorizeRole(ManagerRole role, List functions) { permissionFunctionMapper.clearRolePermission(role.getInverseMask()); permissionFunctionMapper.authorizeRole(role.getMask(), functions); @@ -181,5 +183,4 @@ public class PermissionManagerImpl implements PermissionManager { } - }