diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/PermissionPartnerManager.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/PermissionPartnerManager.java index 2400f4759..c91f8f756 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/PermissionPartnerManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/PermissionPartnerManager.java @@ -3,6 +3,8 @@ package au.com.royalpay.payment.manage.management.sysconfig.core; import au.com.royalpay.payment.manage.management.sysconfig.beans.FuncInfo; import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleInfo; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; +import au.com.royalpay.payment.tools.permission.enums.PartnerRole; + import com.alibaba.fastjson.JSONObject; import java.util.List; @@ -27,7 +29,7 @@ public interface PermissionPartnerManager { List listRoleFunctions(ManagerRole role); - void authorizeRole(ManagerRole role, List functions); + void authorizeRole(PartnerRole role, List functions); List listUserFunctions(int role); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java index 42c34d40b..a70c7997d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java @@ -12,6 +12,7 @@ import au.com.royalpay.payment.manage.permission.manager.scanner.PermissionPartn import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; +import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import au.com.royalpay.payment.tools.utils.id.IdUtil; import com.alibaba.fastjson.JSONObject; @@ -175,7 +176,7 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { } @Override - @CacheEvict(value = ":login:managers:", allEntries = true) + @CacheEvict(value = ":login:partners:", allEntries = true) public void setFunctionModule(String funcId, String moduleName) { if (moduleName == null) { throw new BadRequestException("module name not provided"); @@ -204,10 +205,11 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { @Override @Transactional - @CacheEvict(value = ":login:managers:", allEntries = true) - public void authorizeRole(ManagerRole role, List functions) { - permissionPartnerFunctionMapper.clearRolePermission(role.getInverseMask()); - permissionPartnerFunctionMapper.authorizeRole(role.getMask(), functions); + @CacheEvict(value = ":login:partners:", allEntries = true) + public void authorizeRole(PartnerRole role, List functions) { + + permissionPartnerFunctionMapper.clearRolePermission(role.getCode()); + permissionPartnerFunctionMapper.authorizeRole(role.getCode(), functions); } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionPartnerConfigController.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionPartnerConfigController.java index d24d76633..2e8c67b39 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionPartnerConfigController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionPartnerConfigController.java @@ -5,6 +5,7 @@ import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleIn import au.com.royalpay.payment.manage.management.sysconfig.core.PermissionPartnerManager; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; +import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import com.alibaba.fastjson.JSONObject; @@ -81,8 +82,8 @@ public class SysPermissionPartnerConfigController { public void authorizeRole(@PathVariable String roleMask, @RequestBody List functions){ try { int mask = Integer.parseInt(roleMask, 2); - for (ManagerRole role : ManagerRole.values()) { - if (mask == role.getMask()) { + for (PartnerRole role : PartnerRole.values()) { + if (mask == role.getCode()) { permissionPartnerManager.authorizeRole(role,functions); return; } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/PermissionPartnerFunctionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/PermissionPartnerFunctionMapper.xml index cd677f123..0abaa2209 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/PermissionPartnerFunctionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/PermissionPartnerFunctionMapper.xml @@ -13,13 +13,13 @@ @@ -29,7 +29,7 @@