Package com.eaglegenomics.simlims.core

Examples of com.eaglegenomics.simlims.core.User


      return JSONUtils.SimpleJSONError("No plates to show");
    }
  }

  public JSONObject deletePlate(HttpSession session, JSONObject json) {
    User user;
    try {
      user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
    }
    catch (IOException e) {
      e.printStackTrace();
      return JSONUtils.SimpleJSONError("Error getting currently logged in user.");
    }

    if (user != null && user.isAdmin()) {
      if (json.has("plateId")) {
        Long plateId = json.getLong("plateId");
        try {
          requestManager.deletePlate(requestManager.getPlateById(plateId));
          return JSONUtils.SimpleJSONResponse("Plate deleted");
View Full Code Here


    }
  }

  public JSONObject printPoolBarcodes(HttpSession session, JSONObject json) {
    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
      JSONArray ss = JSONArray.fromObject(json.getString("pools"));

      String serviceName = null;
      if (json.has("serviceName")) {
        serviceName = json.getString("serviceName");
View Full Code Here

      log.info("Adding " + LimsSecurityUtils.toLdapUser(user) + " to LDAP server");
      ldapUserManager.createUser(LimsSecurityUtils.toLdapUser(user));
    }
    else {
    */
      User existingUser = super.getUserByLoginName(user.getLoginName());
      if (existingUser != null) {
        if (SecurityContextHolder.getContext().getAuthentication() != null &&
            SecurityContextHolder.getContext().getAuthentication().isAuthenticated()) {
          //this should be the case if the user has already logged in and is wishing to update details, rather than create

          //TODO - this seems to change the LDAP password (an encrypted version of the already encrypted string)
          //ldapUserManager.updateUser(user.toLdapUser());

          if (user.getUserId() == null) {
            //this will happen if the user auths against LDAP and the user exists in the DB
            //i.e. when they log into the LIMS for the very first time
            user.setUserId(existingUser.getUserId());
          }

          if ("".equals(user.getFullName()) || user.getFullName() == null) {
            throw new IOException("Cannot save user with no full name / display name.");
          }
View Full Code Here

    sb.append("[").append(LimsUtils.join(getRoles(), ",")).append("]");
    return sb.toString();
  }

  public int compareTo(Object o) {
    User t = (User)o;
    if (getUserId() < t.getUserId()) return -1;
    if (getUserId() > t.getUserId()) return 1;
    return 0;
  }
View Full Code Here

    Long libraryId = json.getLong("libraryId");
    String internalOnly = json.getString("internalOnly");
    String text = json.getString("text");

    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
      Library library = requestManager.getLibraryById(libraryId);
      Note note = new Note();
      internalOnly = internalOnly.equals("on") ? "true" : "false";
      note.setInternalOnly(Boolean.parseBoolean(internalOnly));
      note.setText(text);
View Full Code Here

    }
  }

  public JSONObject printLibraryBarcodes(HttpSession session, JSONObject json) {
    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());

      String serviceName = null;
      if (json.has("serviceName")) { serviceName = json.getString("serviceName"); }

      MisoPrintService<File, Barcodable, PrintContext<File>> mps = null;
View Full Code Here

    }
  }

  public JSONObject printLibraryDilutionBarcodes(HttpSession session, JSONObject json) {
    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());

      String serviceName = null;
      if (json.has("serviceName")) { serviceName = json.getString("serviceName"); }

      MisoPrintService<File, Barcodable, PrintContext<File>> mps = null;
View Full Code Here

    String locationBarcode = json.getString("locationBarcode");

    try {
      String newLocation = LimsUtils.lookupLocation(locationBarcode);
      if (newLocation != null) {
        User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
        Library library = requestManager.getLibraryById(libraryId);
        String oldLocation = library.getLocationBarcode();
        library.setLocationBarcode(newLocation);

        Note note = new Note();
        note.setInternalOnly(true);
        note.setText("Location changed from " + oldLocation + " to " + newLocation + " by " + user.getLoginName() + " on " + new Date());
        note.setOwner(user);
        note.setCreationDate(new Date());
        library.getNotes().add(note);
        requestManager.saveLibraryNote(library, note);
        requestManager.saveLibrary(library);
View Full Code Here

      return JSONUtils.SimpleJSONError("Failed to add library QC to this library: " + e.getMessage());
    }
  }

  public JSONObject deleteLibrary(HttpSession session, JSONObject json) {
    User user;
    try {
      user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
    }
    catch (IOException e) {
      e.printStackTrace();
      return JSONUtils.SimpleJSONError("Error getting currently logged in user.");
    }

    if (user != null && user.isAdmin()) {
      if (json.has("libraryId")) {
        Long libraryId = json.getLong("libraryId");
        try {
          requestManager.deleteLibrary(requestManager.getLibraryById(libraryId));
          return JSONUtils.SimpleJSONResponse("Library deleted");
View Full Code Here

      return JSONUtils.SimpleJSONError("Only logged-in admins can delete objects.");
    }
  }

  public JSONObject deleteLibraryDilution(HttpSession session, JSONObject json) {
    User user;
    try {
      user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
    }
    catch (IOException e) {
      e.printStackTrace();
      return JSONUtils.SimpleJSONError("Error getting currently logged in user.");
    }

    if (user != null && user.isAdmin()) {
      if (json.has("libraryDilutionId")) {
        Long libraryDilutionId = json.getLong("libraryDilutionId");
        try {
          requestManager.deleteLibraryDilution(requestManager.getLibraryDilutionById(libraryDilutionId));
          return JSONUtils.SimpleJSONResponse("LibraryDilution deleted");
View Full Code Here

TOP

Related Classes of com.eaglegenomics.simlims.core.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.