master
kira 6 years ago
parent 568e54467f
commit 06967690b9

@ -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<String> listRoleFunctions(ManagerRole role);
void authorizeRole(ManagerRole role, List<String> functions);
void authorizeRole(PartnerRole role, List<String> functions);
List<JSONObject> listUserFunctions(int role);

@ -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<String> functions) {
permissionPartnerFunctionMapper.clearRolePermission(role.getInverseMask());
permissionPartnerFunctionMapper.authorizeRole(role.getMask(), functions);
@CacheEvict(value = ":login:partners:", allEntries = true)
public void authorizeRole(PartnerRole role, List<String> functions) {
permissionPartnerFunctionMapper.clearRolePermission(role.getCode());
permissionPartnerFunctionMapper.authorizeRole(role.getCode(), functions);
}
@Override

@ -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<String> 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;
}

@ -13,13 +13,13 @@
<update id="clearRolePermission">
<![CDATA[
UPDATE sys_permission_partner_functions
SET role = role & #{mask}
SET role = replace(role,#{mask},'')
]]>
</update>
<update id="authorizeRole">
<![CDATA[
UPDATE sys_permission_partner_functions
SET role = role | #{mask}
SET role = concat(role,#{mask})
WHERE func_id in
]]>
<foreach collection="func_ids" item="id" open="(" close=")" separator=",">
@ -29,7 +29,7 @@
<select id="listByRoleMask" resultType="com.alibaba.fastjson.JSONObject">
<include refid="joinModule"/>
<![CDATA[
WHERE f.role & #{mask} >0
WHERE f.role like concat('%',#{mask},'%')
]]>
</select>
<select id="listAll" resultType="com.alibaba.fastjson.JSONObject">

@ -27,7 +27,7 @@
<i class="fa fa-user-secret"></i>
Administrator
</a>
<a class="btn btn-app" role="button" ng-click="authorizeRole('10')">
<a class="btn btn-app" role="button" ng-click="authorizeRole('3')">
<i class="fa fa-eye"></i>
Compliance
</a>

Loading…
Cancel
Save