|
@@ -56,9 +56,10 @@ public class RoleHandler { |
|
|
if (role_id <= 0) return R.error("未指定角色!"); |
|
|
if (role_id <= 0) return R.error("未指定角色!"); |
|
|
SwMap formData = data.readMap("form"); |
|
|
SwMap formData = data.readMap("form"); |
|
|
Set<Long> set = formData.readLongSet("menu"); |
|
|
Set<Long> set = formData.readLongSet("menu"); |
|
|
if (PubUtil.isEmpty(set)) return R.error("未选择菜单!"); |
|
|
|
|
|
|
|
|
//if (PubUtil.isEmpty(set)) return R.error("未选择菜单!"); |
|
|
Role role = RoleCache.getInstance().get(role_id); |
|
|
Role role = RoleCache.getInstance().get(role_id); |
|
|
RoleRightContent rc = new RoleRightContent(role.getPrivilege()); |
|
|
RoleRightContent rc = new RoleRightContent(role.getPrivilege()); |
|
|
|
|
|
rc.resetItem(); |
|
|
for (Long menu_id : set) { |
|
|
for (Long menu_id : set) { |
|
|
MenuPlanItem item = MenuPlanCache.getInstance().getById(role.getSmpId(), menu_id); |
|
|
MenuPlanItem item = MenuPlanCache.getInstance().getById(role.getSmpId(), menu_id); |
|
|
RoleRight right = rc.getRoleRight(item.getId()); |
|
|
RoleRight right = rc.getRoleRight(item.getId()); |
|
@@ -66,8 +67,8 @@ public class RoleHandler { |
|
|
right = new RoleRight(); |
|
|
right = new RoleRight(); |
|
|
right.setId(item.getId()); |
|
|
right.setId(item.getId()); |
|
|
right.setMenuId(item.getMenu()); |
|
|
right.setMenuId(item.getMenu()); |
|
|
right.setMenu(1); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
right.setMenu(1); |
|
|
rc.saveItem(right); |
|
|
rc.saveItem(right); |
|
|
} |
|
|
} |
|
|
if (mp_id > 0) { |
|
|
if (mp_id > 0) { |
|
@@ -81,7 +82,8 @@ public class RoleHandler { |
|
|
} |
|
|
} |
|
|
right.setFunc(formData.readStringSet("func")); |
|
|
right.setFunc(formData.readStringSet("func")); |
|
|
right.setData(formData.readListMap("data")); |
|
|
right.setData(formData.readListMap("data")); |
|
|
right.setField(MenuCache.getInstance().get(item.getMenu()).getRightSet(SwEnum.MenuRightType.FIELD.value), formData.readStringSet("write"), formData.readStringSet("read")); |
|
|
|
|
|
|
|
|
if (item.getMenu() > 0L) |
|
|
|
|
|
right.setField(MenuCache.getInstance().get(item.getMenu()).getRightSet(SwEnum.MenuRightType.FIELD.value), formData.readStringSet("write"), formData.readStringSet("read")); |
|
|
rc.saveItem(right); |
|
|
rc.saveItem(right); |
|
|
} |
|
|
} |
|
|
role.setPrivilege(rc.toContentStr()); |
|
|
role.setPrivilege(rc.toContentStr()); |
|
|