Package com.thinkgem.jeesite.modules.sys.entity

Examples of com.thinkgem.jeesite.modules.sys.entity.User


    if(Global.isDemoMode()){
      addMessage(redirectAttributes, "演示模式,不允许操作!");
      return "redirect:"+Global.getAdminPath()+"/sys/role/assign?id="+roleId;
    }
    Role role = systemService.getRole(roleId);
    User user = systemService.getUser(userId);
    if (user.equals(UserUtils.getUser())) {
      addMessage(redirectAttributes, "无法从角色【" + role.getName() + "】中移除用户【" + user.getName() + "】自己!");
    }else {
      Boolean flag = systemService.outUserInRole(role, userId);
      if (!flag) {
        addMessage(redirectAttributes, "用户【" + user.getName() + "】从角色【" + role.getName() + "】中移除失败!");
      }else {
        addMessage(redirectAttributes, "用户【" + user.getName() + "】从角色【" + role.getName() + "】中移除成功!");
      }     
    }
    return "redirect:"+Global.getAdminPath()+"/sys/role/assign?id="+role.getId();
  }
View Full Code Here


      return "redirect:"+Global.getAdminPath()+"/sys/role/assign?id="+role.getId();
    }
    StringBuilder msg = new StringBuilder();
    int newNum = 0;
    for (int i = 0; i < idsArr.length; i++) {
      User user = systemService.assignUserToRole(role, idsArr[i]);
      if (null != user) {
        msg.append("<br/>新增用户【" + user.getName() + "】到角色【" + role.getName() + "】!");
        newNum++;
      }
    }
    addMessage(redirectAttributes, "已成功分配 "+newNum+" 个用户"+msg);
    return "redirect:"+Global.getAdminPath()+"/sys/role/assign?id="+role.getId();
View Full Code Here

  public static final String CACHE_MENU_LIST = "menuList";
  public static final String CACHE_AREA_LIST = "areaList";
  public static final String CACHE_OFFICE_LIST = "officeList";
 
  public static User getUser(){
    User user = (User)getCache(CACHE_USER);
    if (user == null){
      try{
        Subject subject = SecurityUtils.getSubject();
        Principal principal = (Principal)subject.getPrincipal();
        if (principal!=null){
          user = userDao.get(principal.getId());
//          Hibernate.initialize(user.getRoleList());
          putCache(CACHE_USER, user);
        }
      }catch (UnavailableSecurityManagerException e) {
       
      }catch (InvalidSessionException e){
       
      }
    }
    if (user == null){
      user = new User();
      try{
        SecurityUtils.getSubject().logout();
      }catch (UnavailableSecurityManagerException e) {
       
      }catch (InvalidSessionException e){
View Full Code Here

  public static List<Role> getRoleList(){
    @SuppressWarnings("unchecked")
    List<Role> list = (List<Role>)getCache(CACHE_ROLE_LIST);
    if (list == null){
      User user = getUser();
      DetachedCriteria dc = roleDao.createDetachedCriteria();
      dc.createAlias("office", "office");
      dc.createAlias("userList", "userList", JoinType.LEFT_OUTER_JOIN);
      dc.add(dataScopeFilter(user, "office", "userList"));
      dc.add(Restrictions.eq(Role.FIELD_DEL_FLAG, Role.DEL_FLAG_NORMAL));
View Full Code Here

 
  public static List<Menu> getMenuList(){
    @SuppressWarnings("unchecked")
    List<Menu> menuList = (List<Menu>)getCache(CACHE_MENU_LIST);
    if (menuList == null){
      User user = getUser();
      if (user.isAdmin()){
        menuList = menuDao.findAllList();
      }else{
        menuList = menuDao.findByUserId(user.getId());
      }
      putCache(CACHE_MENU_LIST, menuList);
    }
    return menuList;
  }
View Full Code Here

 
  public static List<Office> getOfficeList(){
    @SuppressWarnings("unchecked")
    List<Office> officeList = (List<Office>)getCache(CACHE_OFFICE_LIST);
    if (officeList == null){
      User user = getUser();
//      if (user.isAdmin()){
//        officeList = officeDao.findAllList();
//      }else{
//        officeList = officeDao.findAllChild(user.getOffice().getId(), "%,"+user.getOffice().getId()+",%");
//      }
View Full Code Here

  @ModelAttribute
  public User get(@RequestParam(required=false) String id) {
    if (StringUtils.isNotBlank(id)){
      return systemService.getUser(id);
    }else{
      return new User();
    }
  }
View Full Code Here

      user.setOffice(UserUtils.getUser().getOffice());
    }

    // 判断显示的用户是否在授权范围内
    String officeId = user.getOffice().getId();
    User currentUser = UserUtils.getUser();
    if (!currentUser.isAdmin()) {
      String dataScope = systemService.getDataScope(currentUser);
      // System.out.println(dataScope);
      if (dataScope.indexOf("office.id=") != -1) {
        String AuthorizedOfficeId = dataScope.substring(dataScope.indexOf("office.id=") + 10, dataScope.indexOf(" or"));
        if (!AuthorizedOfficeId.equalsIgnoreCase(officeId)) {
View Full Code Here

      final HttpServletResponse response, final boolean post) throws ServletException {
    String command = request.getParameter("command");
    String type = request.getParameter("type");
    // 初始化时,如果startupPath文件夹不存在,则自动创建startupPath文件夹
    if ("Init".equals(command)){
      User user = UserUtils.getUser();
      if (user!=null){
        String startupPath = request.getParameter("startupPath");// 当前文件夹可指定为模块名
        if (startupPath!=null){
          String[] ss = startupPath.split(":");
          if (ss.length==2){
            String path = "/userfiles/"+user.getId()+"/"+ss[0]+ss[1];
            String realPath = request.getSession().getServletContext().getRealPath(path);
            FileUtils.createDirectory(realPath);
          }
        }
      }
    }
    // 快捷上传,自动创建当前文件夹,并上传到该路径
    else if ("QuickUpload".equals(command) && type!=null){
      User user = UserUtils.getUser();
      if (user!=null){
        String currentFolder = request.getParameter("currentFolder");// 当前文件夹可指定为模块名
        String path = "/userfiles/"+user.getId()+"/"+type+(currentFolder!=null?currentFolder:"");
        String realPath = request.getSession().getServletContext().getRealPath(path);
        FileUtils.createDirectory(realPath);
      }
    }
//    System.out.println("------------------------");
View Full Code Here

  }

  @RequiresUser
  @RequestMapping("info")
  public String info(User user, Model model) {
    User currentUser = UserUtils.getUser();
    if (StringUtils.isNotBlank(user.getName())){
      if(Global.isDemoMode()){
        model.addAttribute("message", "演示模式,不允许操作!");
        return "modules/sys/userInfo";
      }
     
      currentUser = UserUtils.getUser(true);
      currentUser.setEmail(user.getEmail());
      currentUser.setPhone(user.getPhone());
      currentUser.setMobile(user.getMobile());
      currentUser.setRemarks(user.getRemarks());
      systemService.saveUser(currentUser);
      model.addAttribute("message", "保存用户信息成功");
    }
    model.addAttribute("user", currentUser);
    return "modules/sys/userInfo";
View Full Code Here

TOP

Related Classes of com.thinkgem.jeesite.modules.sys.entity.User

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.