Package com.github.zhangkaitao.shiro.chapter19.dao

Examples of com.github.zhangkaitao.shiro.chapter19.dao.UserDao


     * 根据用户名查找其角色
     * @param username
     * @return
     */
    public Set<String> findRoles(String username) {
        User user =findByUsername(username);
        if(user == null) {
            return Collections.EMPTY_SET;
        }
        return roleService.findRoles(user.getRoleIds().toArray(new Long[0]));
    }
View Full Code Here


     * 根据用户名查找其权限
     * @param username
     * @return
     */
    public Set<String> findPermissions(String username) {
        User user =findByUsername(username);
        if(user == null) {
            return Collections.EMPTY_SET;
        }
        return roleService.findPermissions(user.getRoleIds().toArray(new Long[0]));
    }
View Full Code Here

        return false;
    }

    @Override
    public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
        CurrentUser currentUserAnnotation = parameter.getParameterAnnotation(CurrentUser.class);
        return webRequest.getAttribute(currentUserAnnotation.value(), NativeWebRequest.SCOPE_REQUEST);
    }
View Full Code Here

    prepareData(model, request);
    String page = "login";
    if (request.getParameter("Login") != null) {
      String taikhoan = request.getParameter("taikhoan");
      String matkhau = request.getParameter("matkhau");
      UserDAO khDAO = new UserDAOImpl();
      User kh = khDAO.getUserInfo(taikhoan);
      if (kh != null && matkhau.equals(kh.getPassword())) {

        request.setAttribute("TaiKhoan", taikhoan,
            WebRequest.SCOPE_SESSION);
        request.setAttribute("HoTen", kh.getName(),
View Full Code Here

      String diachi = request.getParameter("diachi");
      String matkhau = request.getParameter("matkhau");
      String dienthoai = request.getParameter("dienthoai");
      String email = request.getParameter("email");
      String zipCode = request.getParameter("zipcode");
      UserDAO khDAO = new UserDAOImpl();
      User khTest = khDAO.getUserInfo(taikhoan);
      if (khTest != null) {
        model.addAttribute("info", "account is available!");
      } else {

        User kh = new User(taikhoan, hoten, diachi, email, dienthoai,
            matkhau, zipCode, null);
        boolean result = khDAO.addUser(kh);
        if (result == true) {
          request.setAttribute("TaiKhoan", taikhoan,
              WebRequest.SCOPE_SESSION);
          request.setAttribute("HoTen", kh.getName(),
              WebRequest.SCOPE_SESSION);
View Full Code Here

        if (request.getParameter("Checkout") != null) {
          String idKhachHang = (String) request.getAttribute(
              "TaiKhoan", WebRequest.SCOPE_SESSION);

          UserDAO khDAO = new UserDAOImpl();
          User kh = khDAO.getUserInfo(idKhachHang);

          if (hoten.equals("") || diachi.equals("")
              || dienthoai.equals("")) {
            model.addAttribute("notice",
                "Please enter all information");
View Full Code Here

  // add a user to database
  public boolean addUser(User u) {
    logger.debug("addUser start");
    Session session = HibernateUtil.getSessionFactory().openSession();
    UserDAO khDAO = new UserDAOImpl();
    if (khDAO.getUserInfo(u.getIduser()) != null) {
      return false;
    }

    Transaction transaction = null;
    try {
View Full Code Here

TOP

Related Classes of com.github.zhangkaitao.shiro.chapter19.dao.UserDao

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.