예제 #1
0
  /**
   * True if all existing users for the identity are valid, otherwise admin is notified.
   *
   * @param signup
   */
  public boolean allUsersForIdentityAreValid(Signup signup) {
    // TODO consider contextId (inside signup already) to search for users (below).
    List<User> userList = userRepository.findByIdentityPrincipal(signup.getPrincipal());

    boolean isActive = userList != null && userList.size() > 0;
    if (!isActive) {
      return true;
    }

    for (User user : userList) {
      if (!user.isAccountNonLocked() || !user.isAccountNonExpired()) {
        notificationSender.send(
            signup.getPrincipal(),
            signup.getFirstName(),
            signup.getLastName(),
            "Inactive user attempting signup.");
        logger.warn("User {} inactive, notification sent", signup.getPrincipal());
        return false;
      }
    }

    return true;
  }
예제 #2
0
 /**
  * Form constructor.
  *
  * @param user
  * @param docCode
  */
 public Part(User user, String docCode) {
   this(user.getEntity(), docCode);
   setOwner(user.getIdentity());
 }
예제 #3
0
 /**
  * Form constructor.
  *
  * @param user
  */
 public Part(User user) {
   this(user.getEntity(), "");
   setOwner(user.getIdentity());
 }