/** * 保存报表权限页面 * * @param roleId * @param menuIds * @param out */ @RequestMapping(value = "/authsaveReport") public void saveAuthReport( HttpServletRequest request, @RequestParam int userId, @RequestParam String reportIds, HttpServletResponse response) throws IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); BigInteger reportRights = RightsHelper.sumRights(Tools.str2StrArray(reportIds)); User user = userService.getUserById(userId); if (user == null) { this.sendMsgToClient(isFailed, response); this.logger.warn("修改用户报表权限失败,user为null"); return; } user.setReportRights(reportRights.toString()); try { userService.updateReportRights(user); this.insertLog(request, "修改用户" + user.getLoginname() + "报表权限"); out.write("success"); } catch (Exception e) { e.printStackTrace(); this.logger.error("修改用户报表权限失败:" + e.getMessage(), e); out.write("failed"); } out.close(); }
/** * 保存用户权限 * * @param userId * @param menuIds * @param out */ @RequestMapping(value = "/auth/save") public void saveAuth( @RequestParam int userId, @RequestParam String menuIds, HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); User user = userService.getUserById(userId); if (user != null) { BigInteger rights = RightsHelper.sumRights(Tools.str2StrArray(menuIds)); user.setRights(rights.toString()); try { userService.updateUserRights(user); this.insertLog(request, "修改用户权限"); out.write("success"); } catch (Exception e) { e.printStackTrace(); this.logger.error("修改用户权限失败:" + e.getMessage(), e); out.write("failed"); } } else { out.write("failed"); } out.close(); }