Examples of VgUser


Examples of com.wizriver.entity.beans.VgUser

    return "viewadmin";
  }
 
  public String input(){
    if(id==null){
      user = new VgUser();
      vgUserManager.store(user);
    }else
      user = vgUserManager.load(VgUser.class, id);
    return "input";
  }
View Full Code Here

Examples of com.wizriver.entity.beans.VgUser

  public String input() throws Exception {
    if (id != null) {
      user = ssUserManager.get(id);
    } else {
      user = new VgUser();
    }
    checkedRoleIds = user.getRoleIds();
    return "UserInput";
  }
View Full Code Here

Examples of com.wizriver.entity.beans.VgUser

    public String edit() {
        if (id != null) {
          user = ssUserManager.get(id);
        } else {
          user = new VgUser();
        }

        return SUCCESS;
    }
View Full Code Here

Examples of com.wizriver.entity.beans.VgUser

   * Testing whether the <code>LoginName</code> already exists    
   * @author:<a href="mailto:bobo2581@gmail.com">bobo</a>
   * @throws IOException
   */
  public String checkLoginNameExist() throws IOException{
      VgUser vu =null;
      try {
         vu = ssUserManager.findUserByLoginName(loginName);
        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here

Examples of com.wizriver.entity.beans.VgUser

            t = t && m1.matches() && m2.matches();
       
        t = t && reCheckPwd();
        t = t && (newPwd1.equals(newPwd2));
        if(t){
            VgUser user = this.ssUserManager.getUserByName(SpringSecurityUtils.getCurrentUserName());
//            newPwd1 += user.getKeyString();
//            newPwd1 = md5.MD5Encode(newPwd1);
            user.setPassword(newPwd1);
            this.ssUserManager.store(user);
        }else{
            t = false;
        }
        String flag = t?"0":"1"; //0:OK 1:NO
View Full Code Here

Examples of com.wizriver.entity.beans.VgUser

    /**
     * Verify password preprocessing
     * @author <a href="bobo2581@gmail.com">bobo</a>
     * */
    public boolean reCheckPwd(){
        VgUser user = this.ssUserManager.getUserByName(SpringSecurityUtils.getCurrentUserName());
        String oldPwd = user.getPassword();
        boolean t = true;
        t = wantPwd!=null?wantPwd.equals(oldPwd)?true:false:false;
        return t;
    }
View Full Code Here

Examples of com.wizriver.entity.beans.VgUser

  public static VgUser getUser(){
    Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        if (principal == null) {
            return null;
        }
        VgUser vu = null ;
        try {
             vu = (VgUser) principal;
        } catch (Exception e) {
          //do nothing
        }
View Full Code Here

Examples of com.wizriver.entity.beans.VgUser

     public static VgUser getCurrentVgUser() throws Exception {
          Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
          if (principal == null) {
              return null;
          }
          VgUser vu = null ;
          try {
                 vu = (VgUser) principal;
            } catch (Exception e) {
//                System.out.println("登陆超时,请重新登录!");
                HttpServletRequest request = ServletActionContext.getRequest();
View Full Code Here

Examples of com.wizriver.entity.beans.VgUser

  /**
   * 获取用户Details信息的回调函数.
   */
  public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException, DataAccessException {

    VgUser user = securityEntityManager.findUserByLoginName(userName);
    if (user == null) {
      throw new UsernameNotFoundException("用户" + userName + " 不存在");
    }

//    GrantedAuthority[] grantedAuths = obtainGrantedAuthorities(user);

    boolean enabled = true;
    boolean accountNonExpired = true;
    boolean credentialsNonExpired = true;
    boolean accountNonLocked = true;

//    org.springframework.security.core.userdetails.User userdetail = new org.springframework.security.core.userdetails.User(
//        user.getLoginName(), user.getPassword(), enabled, accountNonExpired, credentialsNonExpired,
//        accountNonLocked, grantedAuths);
   
//    List<GrantedAuthority> gas = new ArrayList<GrantedAuthority>();
//        for(VgRole roles : user.getRoleList()){
//            GrantedAuthorityImpl ga = new GrantedAuthorityImpl(roles.getName());
//            gas.add(ga);
//        }
//       
//        Authentication auth = new UsernamePasswordAuthenticationToken(user.getId(), null, gas.toArray(new GrantedAuthority[gas.size()]));
//        SecurityContextHolder.getContext().setAuthentication(auth);
    Set<GrantedAuthority> gas = grantedAuthorities(user);
    UserDetails userdetail = new VgUser(user.getId(),user.getLoginName(),user.getRealName(),user.getNickname(),user.getPassword(),enabled,accountNonExpired,credentialsNonExpired,accountNonLocked,gas);
    return userdetail;
  }
View Full Code Here

Examples of com.wizriver.entity.beans.VgUser

//        accountManager.saveUser(u);
//      System.out.println(vgUserDao);
//      VgUser user = commonDao.load(VgUser.class,1l);
//      System.out.println(user.getLoginName());
     
      VgUser user1 = vgUserDao.load(VgUser.class,1l);
      System.out.println(user1.getLoginName());
//     
//      VgUser user2 = new VgUser();
//      user2.setId(6l);
//      user2.setLoginName("bobo2");
//      user2.setNickname("bobo2");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.