/** * 简历提交页 * * @param request * @param response * @param model * @return * @throws IOException */ @RequestMapping(value = "/member/resume.jspx", method = RequestMethod.POST) public String resumeSubmit( CmsUserResume resume, CmsUserExt ext, 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); } ext.setId(user.getId()); cmsUserExtMng.update(ext, user); resume.setId(user.getId()); cmsUserResumeMng.update(resume, user); log.info("update CmsUserExt success. id={}", user.getId()); return FrontUtils.showSuccess(request, model, nextUrl); }
@RequestMapping(value = "/member/jobapply.jspx") public void jobapply( Integer cId, HttpServletRequest request, HttpServletResponse response, ModelMap model) throws JSONException { CmsUser user = CmsUtils.getUser(request); JSONObject object = new JSONObject(); if (user == null) { object.put("result", -1); } else if (cId == null) { object.put("result", -2); } else { Content c = contentMng.findById(cId); if (c == null) { object.put("result", -3); } else if (user.getUserResume() == null) { object.put("result", -4); } else if (user.hasApplyToday(cId)) { object.put("result", 0); } else { CmsJobApply jobApply = new CmsJobApply(); jobApply.setApplyTime(Calendar.getInstance().getTime()); jobApply.setContent(c); jobApply.setUser(user); jobApplyMng.save(jobApply); object.put("result", 1); } } ResponseUtils.renderJson(response, object.toString()); }
/** 登录认证 */ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException { UsernamePasswordToken token = (UsernamePasswordToken) authcToken; CmsUser user = cmsUserMng.findByUsername(token.getUsername()); if (user != null) { UnifiedUser unifiedUser = unifiedUserMng.findById(user.getId()); return new SimpleAuthenticationInfo(user.getUsername(), unifiedUser.getPassword(), getName()); } else { return null; } }
/** 授权 */ protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { String username = (String) principals.getPrimaryPrincipal(); CmsUser user = cmsUserMng.findByUsername(username); CmsSite site = CmsThreadVariable.getSite(); SimpleAuthorizationInfo auth = new SimpleAuthorizationInfo(); if (user != null) { Set<String> viewPermissionSet = new HashSet<String>(); Set<String> perms = user.getPerms(site.getId(), viewPermissionSet); if (!CollectionUtils.isEmpty(perms)) { // 权限加入AuthorizationInfo认证对象 auth.setStringPermissions(perms); } } return auth; }
@RequestMapping(value = "/member/myapplys.jspx", method = RequestMethod.GET) public String myapplys( Integer pageNo, HttpServletRequest request, HttpServletResponse response, ModelMap model) { CmsSite site = CmsUtils.getSite(request); CmsUser user = CmsUtils.getUser(request); FrontUtils.frontData(request, model, site); FrontUtils.frontPageData(request, model); MemberConfig mcfg = site.getConfig().getMemberConfig(); // 没有开启会员功能 if (!mcfg.isMemberOn()) { return FrontUtils.showMessage(request, model, "member.memberClose"); } if (user == null) { return FrontUtils.showLogin(request, model, site); } Pagination pagination = jobApplyMng.getPage( user.getId(), null, null, true, cpn(pageNo), CookieUtils.getPageSize(request)); model.addAttribute("pagination", pagination); return FrontUtils.getTplPath(request, site.getSolutionPath(), TPLDIR_MEMBER, MEMBER_APPLYS); }
private boolean vldOpt(WebErrors errors, CmsSite site, CmsUser user, Integer[] ids) { for (Integer id : ids) { if (errors.ifNull(id, "id")) { return true; } CmsJobApply jobapply = jobApplyMng.findById(id); // 数据不存在 if (errors.ifNotExist(jobapply, CmsJobApply.class, id)) { return true; } // 非本用户数据 if (!jobapply.getUser().getId().equals(user.getId())) { errors.noPermission(Content.class, id); return true; } } return false; }