From a061968138ae66c2b04fff399d40ce86854a844d Mon Sep 17 00:00:00 2001 From: qi_liang Date: Sat, 23 Mar 2019 11:47:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/lq/cms/web/sys/LogController.java | 5 +++-- .../java/com/lq/cms/web/sys/MenuController.java | 14 ++++++++------ .../java/com/lq/cms/web/sys/RoleController.java | 16 ++++++++-------- .../java/com/lq/cms/web/sys/UserController.java | 16 ++++++---------- .../lq/cms/web/wechat/WechatInfoController.java | 12 ++++++++---- 5 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/lq/cms/web/sys/LogController.java b/src/main/java/com/lq/cms/web/sys/LogController.java index 5f8544f..16eaec5 100755 --- a/src/main/java/com/lq/cms/web/sys/LogController.java +++ b/src/main/java/com/lq/cms/web/sys/LogController.java @@ -6,6 +6,7 @@ package com.lq.cms.web.sys; import com.lq.cms.service.SysLogService; import com.lq.cms.vo.SysLogVo; +import com.lq.code.util.Constant; import org.apache.log4j.Logger; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -26,12 +27,12 @@ public class LogController { private static Logger LOGGER = Logger.getLogger(LogController.class); + public static final String INDEX_URL = "/cms/log/index"; @Autowired private SysLogService sysLogService; @RequestMapping("/index") - @RequiresPermissions("/cms/log/index:SELECT") public ModelAndView index(ModelAndView modelAndView){ modelAndView.setViewName("cms/sys/log/index"); return modelAndView; @@ -39,7 +40,7 @@ public class LogController { @ResponseBody @RequestMapping("/list") - @RequiresPermissions("/cms/log/index:SELECT") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_SELECT) public Object list(SysLogVo vo){ Map map=new HashMap(); map.put("total",sysLogService.count(vo)); diff --git a/src/main/java/com/lq/cms/web/sys/MenuController.java b/src/main/java/com/lq/cms/web/sys/MenuController.java index 6996f61..14d5695 100755 --- a/src/main/java/com/lq/cms/web/sys/MenuController.java +++ b/src/main/java/com/lq/cms/web/sys/MenuController.java @@ -4,6 +4,7 @@ import com.lq.cms.emun.StatusTypeEnum; import com.lq.cms.service.SysResourceService; import com.lq.cms.vo.SysResourceVo; import com.lq.code.entity.AjaxResult; +import com.lq.code.util.Constant; import com.lq.code.web.BaseController; import com.lq.entity.SysResource; import com.lq.entity.SysUser; @@ -35,10 +36,12 @@ public class MenuController { private static Logger LOGGER = Logger.getLogger(MenuController.class); + public static final String INDEX_URL = "/cms/menu/index"; + + @Autowired private SysResourceService sysResourceService; - @RequiresPermissions("/cms/menu/index:SELECT") @RequestMapping("/index") public ModelAndView index(ModelAndView modelAndView){ @@ -48,7 +51,7 @@ public class MenuController { @RequestMapping("/list") @ResponseBody - @RequiresPermissions("/cms/menu/index:SELECT") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_SELECT) public Object list(SysResourceVo vo){ Map map=new HashMap(); map.put("total",sysResourceService.count(vo)); @@ -57,7 +60,6 @@ public class MenuController { } @RequestMapping("/edit") - @RequiresPermissions(value={"/cms/menu/index:INSERT","/cms/menu/index:UPDATE"},logical = Logical.OR) public ModelAndView edit(ModelAndView modelAndView,Long id){ //查询可选择的上级目录 List list=sysResourceService.findByParentId(0L); @@ -68,7 +70,7 @@ public class MenuController { return modelAndView; } - @RequiresPermissions("/cms/menu/index:INSERT") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_INSERT) @ResponseBody @RequestMapping("save") public Object save(SysResourceVo vo){ @@ -94,7 +96,7 @@ public class MenuController { return ajaxResult; } - @RequiresPermissions("/cms/menu/index:UPDATE") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_UPDATE) @ResponseBody @RequestMapping("update") public Object update(SysResourceVo vo){ @@ -111,7 +113,7 @@ public class MenuController { return ajaxResult; } - @RequiresPermissions("/cms/menu/index:DELETE") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_DELETE) @RequestMapping("/delete") @ResponseBody public Object delte(SysResource sysResource){ diff --git a/src/main/java/com/lq/cms/web/sys/RoleController.java b/src/main/java/com/lq/cms/web/sys/RoleController.java index c92334d..492d63e 100755 --- a/src/main/java/com/lq/cms/web/sys/RoleController.java +++ b/src/main/java/com/lq/cms/web/sys/RoleController.java @@ -9,6 +9,7 @@ import com.lq.cms.vo.SysRoleResourcePermissionVo; import com.lq.cms.vo.SysRoleVo; import com.lq.code.entity.AjaxResult; import com.lq.code.util.BeanUtil; +import com.lq.code.util.Constant; import com.lq.entity.SysRole; import org.apache.log4j.Logger; import org.apache.shiro.authz.annotation.Logical; @@ -35,6 +36,7 @@ public class RoleController { private static Logger LOGGER = Logger.getLogger(RoleController.class); + public static final String INDEX_URL = "/cms/role/index"; @Autowired private SysRoleService sysRoleService; @@ -42,7 +44,6 @@ public class RoleController { private SysRoleResourcePermissionService sysRoleResourcePermissionService; - @RequiresPermissions("/cms/role/index:SELECT") @RequestMapping("/index") public ModelAndView index(ModelAndView modelAndView){ @@ -50,7 +51,7 @@ public class RoleController { return modelAndView; } - @RequiresPermissions("/cms/role/index:SELECT") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_SELECT) @RequestMapping("/list") @ResponseBody public Object list(SysRoleVo vo){ @@ -61,7 +62,7 @@ public class RoleController { return map; } - @RequiresPermissions(value={"/cms/role/index:INSERT","/cms/role/index:UPDATE"},logical = Logical.OR) + // @RequiresPermissions(value={"/cms/role/index:INSERT","/cms/role/index:UPDATE"},logical = Logical.OR) @RequestMapping("/edit") public ModelAndView edit(ModelAndView modelAndView,Long id){ if (id!=null) { @@ -72,7 +73,6 @@ public class RoleController { return modelAndView; } - @RequiresPermissions("/cms/role/index:UPDATE") @RequestMapping("/permissionEdit") public ModelAndView permission(ModelAndView modelAndView,Long roleId){ List list=sysRoleResourcePermissionService.findZtree(roleId); @@ -82,7 +82,7 @@ public class RoleController { return modelAndView; } - @RequiresPermissions("/cms/role/index:UPDATE") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_UPDATE) @RequestMapping("/updatePermission") @ResponseBody public Object updatePermission(@RequestBody List list){ @@ -91,7 +91,7 @@ public class RoleController { return ajaxResult; } - @RequiresPermissions("/cms/role/index:UPDATE") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_INSERT) @RequestMapping("/save") @ResponseBody public Object save(SysRole sysRole){ @@ -109,7 +109,7 @@ public class RoleController { return ajaxResult; } - @RequiresPermissions("/cms/role/index:UPDATE") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_UPDATE) @RequestMapping("/update") @ResponseBody public Object update(SysRole sysRole){ @@ -126,7 +126,7 @@ public class RoleController { return ajaxResult; } - @RequiresPermissions("/cms/role/index:DELETE") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_DELETE) @RequestMapping("/delete") @ResponseBody public Object delte(SysRole sysRole){ diff --git a/src/main/java/com/lq/cms/web/sys/UserController.java b/src/main/java/com/lq/cms/web/sys/UserController.java index 94c5b17..25cca2a 100755 --- a/src/main/java/com/lq/cms/web/sys/UserController.java +++ b/src/main/java/com/lq/cms/web/sys/UserController.java @@ -8,10 +8,7 @@ import com.lq.cms.service.SysUserService; import com.lq.cms.vo.SysUserRoleVo; import com.lq.cms.vo.SysUserVo; import com.lq.code.entity.AjaxResult; -import com.lq.code.util.BeanUtil; -import com.lq.code.util.FileUtil; -import com.lq.code.util.Md5Util; -import com.lq.code.util.StringUtil; +import com.lq.code.util.*; import com.lq.entity.SysUser; import org.apache.log4j.Logger; import org.apache.shiro.SecurityUtils; @@ -45,7 +42,7 @@ public class UserController { private final static Logger LOGGER = Logger.getLogger(UserController.class); - private final static String SHIRO_SCOPE="/cms/user/index:"; + private final static String INDEX_URL="/cms/user/index"; private final static String PERMISSION_SELECT="SELECT"; @@ -63,7 +60,6 @@ public class UserController { @Value("${file.upload}") private String FILE_LOAD_PATH; - @RequiresPermissions(SHIRO_SCOPE+PERMISSION_SELECT) @RequestMapping("/index") public ModelAndView index(ModelAndView modelAndView){ @@ -71,7 +67,7 @@ public class UserController { return modelAndView; } - @RequiresPermissions(SHIRO_SCOPE+PERMISSION_SELECT) + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_SELECT) @RequestMapping("/list") @ResponseBody public Object list(SysUserVo vo){ @@ -92,7 +88,7 @@ public class UserController { } - @RequiresPermissions("/cms/user/index:INSERT") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_INSERT) @ResponseBody @RequestMapping(value = "/save",method = RequestMethod.POST) public Object save(SysUserVo vo,@RequestParam(value = "file",required = false) MultipartFile file){ @@ -111,7 +107,7 @@ public class UserController { return ajaxResult; } - @RequiresPermissions("/cms/user/index:UPDATE") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_UPDATE) @ResponseBody @RequestMapping("/update") public Object update(SysUserVo vo,@RequestParam(value = "file",required = false) MultipartFile file){ @@ -135,7 +131,7 @@ public class UserController { - @RequiresPermissions("/cms/user/index:DELETE") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_DELETE) @RequestMapping("/delete") @ResponseBody public Object delte(SysUser sysUser){ diff --git a/src/main/java/com/lq/cms/web/wechat/WechatInfoController.java b/src/main/java/com/lq/cms/web/wechat/WechatInfoController.java index 6b3fb42..b41cd8a 100755 --- a/src/main/java/com/lq/cms/web/wechat/WechatInfoController.java +++ b/src/main/java/com/lq/cms/web/wechat/WechatInfoController.java @@ -6,6 +6,7 @@ import com.lq.cms.emun.WechatInfoTypeEnum; import com.lq.cms.service.WechatInfoService; import com.lq.cms.vo.WechatInfoVo; import com.lq.code.entity.AjaxResult; +import com.lq.code.util.Constant; import com.lq.entity.WechatInfo; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.BeanUtils; @@ -26,6 +27,9 @@ import java.util.Map; @RequestMapping("/cms/wechat/info") public class WechatInfoController { + private static final String INDEX_URL = "/cms/wechat/info/index"; + + @Autowired private WechatInfoService wechatInfoService; @@ -51,7 +55,7 @@ public class WechatInfoController { return modelAndView; } - @RequiresPermissions("/cms/wechat/info/index:SELECT") + @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_SELECT) @ResponseBody @RequestMapping("/list") public Object list(WechatInfoVo vo){ @@ -61,7 +65,7 @@ public class WechatInfoController { return map; } - @RequiresPermissions("/cms/wechat/info/index:INSERT") + @RequiresPermissions(INDEX_URL+Constant.PERSSION_MARK+Constant.PERMISSION_INSERT) @ResponseBody @RequestMapping("/save") public Object save(WechatInfoVo vo){ @@ -75,7 +79,7 @@ public class WechatInfoController { return ajaxResult; } - @RequiresPermissions("/cms/wechat/info/index:UPDATE") + @RequiresPermissions(INDEX_URL+Constant.PERSSION_MARK+Constant.PERMISSION_UPDATE) @ResponseBody @RequestMapping("/update") public Object update(WechatInfoVo vo){ @@ -86,7 +90,7 @@ public class WechatInfoController { return ajaxResult; } - @RequiresPermissions("/cms/wechat/info/index:DELETE") + @RequiresPermissions(INDEX_URL+Constant.PERSSION_MARK+Constant.PERMISSION_DELETE) @ResponseBody @RequestMapping("/delete") public Object delete(WechatInfoVo vo){