Package com.google.code.lightssh.project.security.entity

Examples of com.google.code.lightssh.project.security.entity.LoginAccount


  public LoginAccount getLight( String name ){
    return getDao().getWithPartyIdentity( name ); //TODO
  }
 
  public LoginAccount getWithParty( String name ){
    LoginAccount result = getDao().getWithPartyIdentity( name );
    /*
    if( result != null && result.getParty_id() != null ){
      Member member = memberManager.getLightMember( result.getParty_id() );
      Party party = member;
      if( party == null ){
View Full Code Here


    return result;
  }

  @Override
  public void initLoginAccount() {
    LoginAccount root = getDao().get( ROOT_LOGIN_NAME );
    if( root == null ){
      root = new LoginAccount( );
      root.setCreateDate( new Date() );
      root.setLoginName(ROOT_LOGIN_NAME);
      root.setStatus(AuditStatus.EFFECTIVE);
      root.setType(LoginAccountType.ADMIN);
      Role superRole = roleManager.initRole(true);
      root.addRole(superRole);
      root.setPassword(CryptographyUtil.hashMd5Hex(DEFAULT_PASSWORD ) );
      root.setDescription("系统初始化自动创建。");
     
      try{
        save(root);
        log.info("成功初始化系统管理员[{}]!",ROOT_LOGIN_NAME);
      }catch( Exception e ){
View Full Code Here

   */
  public void updatePassword( String name,String password,String newPassword ){
    if( password == null || newPassword == null  )
      throw new ApplicationException("原密码或新密码为空!");
   
    LoginAccount account = getDao().get(name);
    if( account == null )
      throw new ApplicationException("找不到名称为"+name+"的账号!");
   
    String hash_pwd =  CryptographyUtil.hashMd5Hex( password );
    String hash_new_pwd = CryptographyUtil.hashMd5Hex( newPassword );
   
    if( !account.getPassword().equals( hash_pwd ))
      throw new ApplicationException("原密码不正确!");
   
    account.setPassword( hash_new_pwd  );
    account.setLastUpdatePasswordTime(Calendar.getInstance());//密码更新时间
    super.dao.update( account );
  }
View Full Code Here

   * 重置密码
   * @param name 登录帐号
   * @param newPassword 新密码
   */
  public void resetPassword( String name,String newPassword ){
    LoginAccount account = getDao().get(name);
    if( account == null )
      throw new ApplicationException("找不到名称为"+name+"的账号!");
   
    String hash_new_pwd = CryptographyUtil.hashMd5Hex( newPassword );

    account.setPassword( hash_new_pwd  );
    account.setLastUpdatePasswordTime(Calendar.getInstance());//密码更新时间
    super.dao.update( account );
   
    log.info("系统登录帐号[{}]密码被重置!",name);
  }
View Full Code Here

       
      }
      account.setRoles(dbRoles);
    }
   
    LoginAccount dbAcc = getDao().get( account.getLoginName() );
    LoginAccount originalAcc = null,newAcc = account;
    if( dbAcc != null )
      originalAcc = dbAcc.clone();
   
    if( dbAcc == null && !inserted )
      throw new ApplicationException( "登录账号已不存在,不能进行修改操作!" );
View Full Code Here

    //有经办人,直接提交到下一个处理流程(启动流程后,根据 bizKey 查询Task,然后提交 )
    workflowManager.claimAndComplete(pi.getProcessInstanceId(), operator.getLoginName() );
  }
 
  public void remove( Serializable identity ){
    LoginAccount db_account = dao.read(identity);
    if( db_account != null && ROOT_LOGIN_NAME.equals(db_account.getLoginName()) )
      throw new ApplicationException("系统超级管理员账户不允许删除!");

    //String name = db_account.getLoginName();
    super.remove(identity);
  }
View Full Code Here

    //String name = db_account.getLoginName();
    super.remove(identity);
  }
 
  public void remove(LoginAccount account,LoginAccount operator,String remark) {
    LoginAccount dbAcc = dao.read(account.getId());
    if( dbAcc == null )
      throw new ApplicationException("登录帐号不存在!");
   
    if( ROOT_LOGIN_NAME.equals(dbAcc.getLoginName()) )
      throw new ApplicationException("系统超级管理员账户不允许删除!");
   
    if( remark == null )
      remark = "删除角色";
    LoginAccount newAcc = dbAcc.clone();
    newAcc.setStatus(AuditStatus.DELETE);
    loginAccountChangeManager.save(operator
        ,EntityChange.Type.DELETE,dbAcc, newAcc,remark);
  }
View Full Code Here

      remove( account.getIdentity() );
  }
 
  public List<LoginAccount> listAdmin( ){
    ListPage<LoginAccount> page = new ListPage<LoginAccount>( 1024 );
    LoginAccount t = new LoginAccount();
    t.setType(LoginAccountType.ADMIN);
    page = getDao().listLight(page,t);
    return page.getList();
  }
View Full Code Here

 
  public void toggleCa( LoginAccount account ,Access access ){
    if( account == null || account.getIdentity() == null )
      return ;
   
    LoginAccount old = this.get(account);
    if( old == null ){
      log.warn("开启或禁用CA,找不到相关登录账户!");
      throw new ApplicationException("找不到相关数据!");
    }
   
    boolean close = old.isUseCa();
    old.setUseCa( !close );
   
    this.dao.update( old );
   
    String desc = "成功"+(close?"禁用":"启用")+"帐号["+old.getLoginName()+"]CA登录!";
    log.info( desc );
    if( access != null ){
      //access.setType( AccessType.SECURITY_ACCOUNT_CA );
      //access.setDescription(desc);
      //this.accessManager.save( access );
View Full Code Here

      //this.accessManager.save( access );
    }
  }
  @Override
  public List<LoginAccount> listByParty(Party party) {
    LoginAccount account = new LoginAccount();
    account.setParty( party );
   
    ListPage<LoginAccount> page = new ListPage<LoginAccount>();
    page.setSize( Integer.MAX_VALUE );
    dao.list(page,account);
   
View Full Code Here

TOP

Related Classes of com.google.code.lightssh.project.security.entity.LoginAccount

Copyright © 2018 www.massapicom. 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.