Examples of UserDao


Examples of com.serotonin.m2m2.db.dao.UserDao

    public void jsonRead(JsonReader reader, JsonObject jsonObject) throws JsonException {
        if (isNew()) {
            String username = jsonObject.getString("user");
            if (StringUtils.isBlank(username))
                throw new TranslatableJsonException("emport.error.missingValue", "user");
            User user = new UserDao().getUser(username);
            if (user == null)
                throw new TranslatableJsonException("emport.error.missingUser", username);
            userId = user.getId();
        }
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

    }

    @Override
    public int doStartTag() throws JspException {
        // Check the user id.
        User user = new UserDao().getUser(username);
        if (user == null)
            throw new JspException("Username '" + username + "' not found");
        if (user.isDisabled())
            throw new JspException("Username '" + username + "' is disabled");
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

     */
    @Override
  protected List<User> getShareUsers(User excludeUser) {
     
      if(excludeUser.isAdmin()){
        return new UserDao().getUsers();
      }else{
      List<User> users = new ArrayList<User>();
      for (User u : new UserDao().getUsers()) {
        if (u.getId() != excludeUser.getId())
          users.add(u);
      }
      return users;
      }
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

        WatchListCommon.ensureWatchListEditPermission(user, watchList);

        // Add it to the watch list.
        watchList.getPointList().add(point);
        new WatchListDao().saveWatchList(watchList);
        updateSetPermission(point, watchList.getUserAccess(user), new UserDao().getUser(watchList.getUserId()));

        // Return the watch list state for it.
        return createWatchListState(request, point, Common.runtimeManager, new HashMap<String, Object>(), user);
    }
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

        return data;
    }

    private void prepareWatchList(WatchList watchList, User user) {
        int access = watchList.getUserAccess(user);
        User owner = new UserDao().getUser(watchList.getUserId());
        for (DataPointVO point : watchList.getPointList())
            updateSetPermission(point, access, owner);
    }
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

            }
        }

        String wlxid = request.getParameter("wlxid");
       
        UserDao userDao = new UserDao();
        boolean found = false;
        List<IntStringPair> watchListNames = new ArrayList<IntStringPair>(watchLists.size());
        List<IntStringPair> watchListUsers = new ArrayList<IntStringPair>(watchLists.size());
        List<IntStringPair> userWatchLists = new ArrayList<IntStringPair>(watchLists.size());
        for (WatchList watchList : watchLists) {
            if (!found) {
                if (StringUtils.equals(watchList.getXid(), wlxid)) {
                    found = true;
                    selected = watchList.getId();
                }
                else if (watchList.getId() == selected)
                    found = true;
            }

            if (watchList.getUserAccess(user) == ShareUser.ACCESS_OWNER) {
                // If this is the owner, check that the user still has access to the points. If not, remove the
                // unauthorized points, resave, and continue.
                boolean changed = false;
                List<DataPointVO> list = watchList.getPointList();
                List<DataPointVO> copy = new ArrayList<DataPointVO>(list);
                for (DataPointVO point : copy) {
                    if (point == null || !Permissions.hasDataPointReadPermission(user, point)) {
                        list.remove(point);
                        changed = true;
                    }
                }

                if (changed)
                    watchListDao.saveWatchList(watchList);
            }

            User watchListUser = userDao.getUser(watchList.getUserId());
            String username;
            if(watchListUser == null){
              username = Common.translate("watchlist.userDNE");
            }else{
              username = watchListUser.getUsername();
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

    //
    // Serialization
    //
    @Override
    public void jsonWrite(ObjectWriter writer) throws IOException, JsonException {
        writer.writeEntry("user", new UserDao().getUser(userId).getUsername());

        List<String> dpXids = new ArrayList<String>();
        for (DataPointVO dpVO : pointList)
            dpXids.add(dpVO.getXid());
        writer.writeEntry("dataPoints", dpXids);
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

    @Override
    public void jsonRead(JsonReader reader, JsonObject jsonObject) throws JsonException {
        String username = jsonObject.getString("user");
        if (StringUtils.isBlank(username))
            throw new TranslatableJsonException("emport.error.missingValue", "user");
        User user = new UserDao().getUser(username);
        if (user == null)
            throw new TranslatableJsonException("emport.error.missingUser", username);
        userId = user.getId();

        JsonArray jsonDataPoints = jsonObject.getJsonArray("dataPoints");
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

            if (getModule().license() == null)
                ValidationUtils.reject(errors, "crowd.license");

            // The user is logged into Crowd. Make sure the username is valid in this instance.
            User user = new UserDao().getUser(username);
            if (user == null)
                ValidationUtils.rejectValue(errors, "username", "login.validation.noSuchUser");
            else {
                // Validate some stuff about the user.
                if (user.isDisabled())
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

          "alter table reportInstances add mapping blob;",
          "alter table reportInstancePoints add xid varchar(50);",
          "update reportInstancePoints set xid='legacyReport';"});
     
      ReportDao dao = new ReportDao();
      UserDao ud = new UserDao();
      List<ReportVO> reports = dao.getReports();
      List<ReportInstance> reportInstances;
      List<User> users = ud.getUsers();
      for(User u : users) {
        reportInstances = dao.getReportInstances(u.getId());
        for(ReportInstance ri : reportInstances) {
          for(ReportVO report : reports) {
            if(ri.getName().equals(report.getName())) {
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.