Examples of Usr


Examples of org.svnadmin.entity.Usr

 
  /**
   * @return 当前的用户
   */
  public static Usr getCurrentUsr() {
    Usr usr = USR_THREAD_LOCAL.get();
    if(usr == null){
      throw new RuntimeException("当前线程没有设置用户!");
    }
        return usr;
    }
View Full Code Here

Examples of org.svnadmin.entity.Usr

   */
  @Transactional
  public Usr login(String usr, String psw) {
    int usrCount = this.getCount();
    if (usrCount == 0) {// 第一次使用,设置管理员
      Usr entity = new Usr();
      entity.setUsr(usr);
      entity.setPsw(EncryptUtil.encrypt(psw));
      entity.setRole(Constants.USR_ROLE_ADMIN);
      this.usrDao.insert(entity);
      // *
      Usr all = new Usr();
      all.setUsr("*");
      all.setPsw("*");
      this.usrDao.insert(all);
      //
      return entity;
    }
    // 正常登录
    Usr entity = this.get(usr);
    if (entity == null) {
      throw new RuntimeException(I18N.getLbl("login.error.notfoundusr", "不存在用户{0} ",new Object[]{usr}));
    }
    if (!entity.getPsw().equals(EncryptUtil.encrypt(psw))) {
      throw new RuntimeException(I18N.getLbl("login.error.wrongpassword", "密码错误 "));
    }
    return entity;
  }
View Full Code Here

Examples of org.svnadmin.entity.Usr

  protected boolean hasManagerRight(HttpServletRequest request,
      HttpServletResponse response) {
    if (hasAdminRight(request)) {
      return true;
    }
    Usr usr = getUsrFromSession(request);
    String pj = request.getParameter("pj");
    return pjGrUsrService.hasManagerRight(usr, pj);
  }
View Full Code Here

Examples of org.svnadmin.entity.Usr

  }

  @Override
  protected void save(HttpServletRequest request, HttpServletResponse response) {

    Usr entity = new Usr();
    entity.setUsr(request.getParameter("usr"));
    entity.setName(request.getParameter("name"));
    if (StringUtils.isNotBlank(request.getParameter("newPsw"))) {
      entity.setPsw(EncryptUtil.encrypt(request.getParameter("newPsw")));
    } else {
      entity.setPsw(request.getParameter("psw"));
    }
    entity.setRole(request.getParameter("role"));
    request.setAttribute("entity", entity);

    usrService.save(entity);

    if (entity.getUsr().equals(getUsrFromSession(request).getUsr())) {// 当前用户
      request.getSession().setAttribute(Constants.SESSION_KEY_USER, entity);
    }
  }
View Full Code Here

Examples of org.svnadmin.entity.Usr

      HttpServletResponse response) throws IOException, ServletException {

    boolean hasAdminRight = hasAdminRight(request);
    request.setAttribute("hasAdminRight", hasAdminRight);

    Usr sessionUsr = getUsrFromSession(request);
    if (!hasAdminRight) {
      request.setAttribute("entity", sessionUsr);
    }
    //查看用户权限
    String usr = request.getParameter("usr");
    if(StringUtils.isBlank(usr)){
      usr = sessionUsr.getUsr();
    }
    boolean hasUsr = StringUtils.isNotBlank(usr);
    if (hasUsr) {
      List<PjAuth> auths = this.usrService.getAuths(usr);
      request.setAttribute("auths", auths);
View Full Code Here

Examples of org.svnadmin.entity.Usr

   * @return svn仓库
   * @throws SVNException svn异常,例如没有权限等
   */
  public SVNRepository getRepository(Pj pj) throws SVNException{
   
    Usr usr = UsrProvider.getCurrentUsr();
   
    String svnUrl = parseURL(pj.getUrl());
    if(StringUtils.isBlank(svnUrl)){
      throw new RuntimeException(I18N.getLbl("pj.error.url", "URL不可以为空"));
    }
    String svnUserName = usr.getUsr();
    String svnPassword = usr.getPsw();
    if(!Constants.HTTP_MUTIL.equals(pj.getType())){
      //pj_usr覆盖用户的密码
      PjUsr pjUsr = pjUsrDao.get(pj.getPj(), svnUserName);
      if(pjUsr != null){
        svnPassword = pjUsr.getPsw();
View Full Code Here

Examples of org.svnadmin.entity.Usr

   * @return Usr对象
   * @throws SQLException
   *             JDBC异常
   */
  Usr readUsr(ResultSet rs) throws SQLException {
    Usr result = new Usr();
    result.setUsr(rs.getString("usr"));
    result.setName(rs.getString("name"));
    result.setPsw(rs.getString("psw"));
    result.setRole(rs.getString("role"));
    return result;
  }
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.