@RequiresPermissions("data:o_revert") @RequestMapping("/mysql/data/o_revert.do") public String revert( String filename, String db, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws IOException { String backpath = realPathResolver.get(Constants.BACKUP_PATH); String backFilePath = backpath + SLASH + filename; String sql = readFile(backFilePath); // 还原暂时没做备份提示。 dataBackMng.executeSQL("use " + SPLIT + db + SPLIT + BR); dataBackMng.executeSQL(sql); // 若db发生变化,需要处理jdbc try { String defaultCatalog = dataBackMng.getDefaultCatalog(); if (!defaultCatalog.equals(db)) { String dbXmlPath = realPathResolver.get(dbXmlFileName); dbXml(dbXmlPath, defaultCatalog, db); } } catch (Exception e) { WebErrors errors = WebErrors.create(request); errors.addErrorCode("db.revert.error"); errors.addErrorString(e.getMessage()); if (errors.hasErrors()) { return errors.showErrorPage(model); } } model.addAttribute("msg", "success"); return listDataBases(model, request, response); }
/** * 密码修改提交页 * * @param origPwd 原始密码 * @param newPwd 新密码 * @param email 邮箱 * @param nextUrl 下一个页面地址 * @param request * @param response * @param model * @return * @throws IOException */ @RequestMapping(value = "/member/pwd.jspx", method = RequestMethod.POST) public String passwordSubmit( String origPwd, String newPwd, String email, String nextUrl, HttpServletRequest request, HttpServletResponse response, ModelMap model) throws IOException { CmsSite site = CmsUtils.getSite(request); CmsUser user = CmsUtils.getUser(request); FrontUtils.frontData(request, model, site); MemberConfig mcfg = site.getConfig().getMemberConfig(); // 没有开启会员功能 if (!mcfg.isMemberOn()) { return FrontUtils.showMessage(request, model, "member.memberClose"); } if (user == null) { return FrontUtils.showLogin(request, model, site); } WebErrors errors = validatePasswordSubmit(user.getId(), origPwd, newPwd, email, request); if (errors.hasErrors()) { return FrontUtils.showError(request, response, model, errors); } cmsUserMng.updatePwdEmail(user.getId(), newPwd, email); return FrontUtils.showSuccess(request, model, nextUrl); }
@RequiresPermissions("data:o_delete_single") @RequestMapping("/mysql/data/o_delete_single.do") public String deleteSingle( HttpServletRequest request, ModelMap model, HttpServletResponse response) { String name = RequestUtils.getQueryParam(request, "name"); WebErrors errors = validateDelete(new String[] {name}, request); if (errors.hasErrors()) { return errors.showErrorPage(model); } int count = resourceMng.delete(new String[] {name}); log.info("delete Resource {}, count {}", name, count); cmsLogMng.operating(request, "resource.log.delete", "filename=" + name); return listBackUpFiles(model, request, response); }
@RequiresPermissions("data:o_delete") @RequestMapping("/mysql/data/o_delete.do") public String delete( String root, String[] names, HttpServletRequest request, ModelMap model, HttpServletResponse response) { WebErrors errors = validateDelete(names, request); if (errors.hasErrors()) { return errors.showErrorPage(model); } int count = resourceMng.delete(names); log.info("delete Resource count: {}", count); for (String name : names) { log.info("delete Resource name={}", name); cmsLogMng.operating(request, "resource.log.delete", "filename=" + name); } model.addAttribute("root", root); return listBackUpFiles(model, request, response); }