예제 #1
0
 /**
  * 修改密码
  *
  * @return
  */
 public String editPassword() {
   User dbResult = userManager.getById(getCurrUser().getUserID());
   User user = this.userManager.getById(getCurrUser().getUserID());
   String pwd = getRequest().getParameter("password");
   String pwdold = getRequest().getParameter("password_old");
   String msg = "修改密码成功";
   int type = 1;
   if (pwdold.equals(dbResult.getPassword())) {
     dbResult.setPassword(pwd);
     try {
       userManager.saveOrUpdate(dbResult);
       // 提示信息
       Flash.current().success(RESET_PASSWORD_SUCCESS);
     } catch (Exception e) {
       e.printStackTrace();
       msg = "修改密码失败!";
       type = 2;
       // 提示信息
       // Flash.current().success(RESET_PASSWORD_FAILURE);
     }
   } else {
     msg = "原始密码错误!";
     type = 3;
   }
   getRequest().setAttribute("type", type);
   getRequest().setAttribute("msg", msg);
   return "update_password";
 }
예제 #2
0
  /**
   * 角色授予
   *
   * @return
   */
  public String grantRole() {
    Set<Role> roles = new HashSet<Role>(0);
    if (items != null) {
      for (String roleID : items) {
        Role role = roleManager.getById(roleID);
        roles.add(role);
      }
    }
    user.setRoles(roles);
    userManager.saveOrUpdate(user);

    // Flash.current().success(UPDATE_SUCCESS);
    return "closeDialog";
  }
예제 #3
0
  /**
   * 修改个人设置
   *
   * @return
   */
  public String editPerson() {
    User dbResult = userManager.getById(getCurrUser().getUserID());
    //		dbResult.setPhone(user.getPhone());
    // dbResult.setBirthday(user.getBirthday());
    // dbResult.setSex(user.getSex());
    //		dbResult.setMail(user.getMail());
    //		dbResult.setQq(user.getQq());
    //		dbResult.setMsn(user.getMsn());
    //		dbResult.setWblog(user.getWblog());
    /*// 维护组织机构信息
    this.organizationUserRelationManager.removeOURByUserId(getCurrUser().getUserID());
    if (user.getDeptIDs() != null && !user.getDeptIDs().equals("")) {
    	String[] organizationIds = user.getDeptIDs().split(",");
    	for (String organizationId : organizationIds) {
    		OrganizationUserRelation our = new OrganizationUserRelation();
    		our.setOrganizationId(organizationId);
    		our.setUserId(getCurrUser().getUserID());

    		this.organizationUserRelationManager.save(our);
    	}
    }*/
    /*
     * 判断图片是否被更改,以优化程序,不必每次都调用webservice

    String fileName = getRequest().getParameter(FILE_NAME);
    if (StringUtils.isNotEmpty(fileName)) {
    	// 创建一个webservice
    	ClientAttachmentService clientAttach = new ClientAttachmentService();
    	clientAttach.deleteAttach(dbResult.getId(), "true", null,
    			getRequest().getParameter("attach_client_id"));
    	clientAttach.saveAttach(dbResult.getId(), getRequest()
    			.getParameter("attach_client_id"), getRequest()
    			.getParameter("attach_form_key"), FILE_NAME, FILE_MODEL);
    	System.out.println(getRequest().getParameter("attach_client_id"));
    	System.out.println(getRequest().getParameter("attach_form_key"));
    }*/
    userManager.saveOrUpdate(dbResult);
    Flash.current().success("修改个人信息成功!");
    return "editPersonPage";
  }