Read user properties from the node in the storage.

@param userNode
the node where user properties are stored
@return {@link User}
551183
public UserImpl readUser(Node userNode) throws Exception
   {
      UserImpl user = new UserImpl(userNode.getName());

      Date creationDate = utils.readDate(userNode, UserProperties.JOS_CREATED_DATE);
      Date lastLoginTime = utils.readDate(userNode, UserProperties.JOS_LAST_LOGIN_TIME);
      String email = utils.readString(userNode, UserProperties.JOS_EMAIL);
      String password = utils.readString(userNode, UserProperties.JOS_PASSWORD);
      String firstName = utils.readString(userNode, UserProperties.JOS_FIRST_NAME);
      String lastName = utils.readString(userNode, UserProperties.JOS_LAST_NAME);
      String displayName = utils.readString(userNode, UserProperties.JOS_DISPLAY_NAME);
      boolean enabled = userNode.canAddMixin(JCROrganizationServiceImpl.JOS_DISABLED);

      user.setInternalId(userNode.getUUID());
      user.setCreatedDate(creationDate);
      user.setLastLoginTime(lastLoginTime);
      user.setEmail(email);
      user.setPassword(password);
      user.setFirstName(firstName);
      user.setLastName(lastName);
      user.setDisplayName(displayName);
      user.setEnabled(enabled);

      return user;
   }
149047
public Response createUser(UserEntity userEntity) {
		return restClient.post("users", userEntity, new HashMap<String, String>());
	}
215054
public User getOrCreateUser(JsonNode data) {
        long id = Long.parseLong(data.get("id").asText());
        synchronized (users) {
            return getCachedUserById(id).orElseGet(() -> {
                if (!data.has("username")) {
                    throw new IllegalStateException("Couldn't get or created user. Please inform the developer!");
                }
                return new UserImpl(this, data);
            });
        }
    }
372579
public static List<String> getAllUserStoreNamesOnNode(AdminClient adminClient, Integer nodeId) {
        List<String> storeNames = Lists.newArrayList();
        List<StoreDefinition> storeDefinitionList = adminClient.metadataMgmtOps.getRemoteStoreDefList(nodeId)
                                                                               .getValue();

        for(StoreDefinition storeDefinition: storeDefinitionList) {
            storeNames.add(storeDefinition.getName());
        }
        return storeNames;
    }
776497
private UserProfile readProfile(Session session, String userName) throws Exception
   {
      Node profileNode;
      try
      {
         profileNode = utils.getProfileNode(session, userName);
      }
      catch (PathNotFoundException e)
      {
         return null;
      }

      return readProfile(userName, profileNode);
   }
553012
@SuppressWarnings("unchecked")
    @Override
	public <T extends ApiUser> T getUserByName(String username) {
	    User sfsUser = getZone().getUserByName(username);
        if(sfsUser != null && sfsUser.containsProperty(APIKey.USER))
            return (T) sfsUser.getProperty(APIKey.USER);
        return null;
	}
95838
@Override
    public Set<Node> findUsers(final String uid) {
        QueryBuilder qb = new LdapQueryBuilder();
        if ("*".equals(uid)) {
            qb.append(LdapKeys.OBJECT_CLASS, userObjectClass);
        } else {
            qb.append(LdapKeys.OBJECT_CLASS, userObjectClass);
            qb.append(userIdentifyer, uid + "*");
        }
        return findUsers(qb);
    }
1202548
private static Set<String> extractUserRoles(final UsersType.User user) {
        Set<String> roles = new TreeSet<>();
        if (user == null) {
            return roles;
        }

        if (user.getRoles() != null && !user.getRoles().trim().isEmpty()) {
            String [] rolelist = user.getRoles().trim().split(",");
            for (String role: rolelist) {
                if( role == null || role.trim().isEmpty()) {
                    continue;
                }
                roles.add(role.trim().toLowerCase());
            }
        }

        return roles;
    }
615400
public String setUser(String uid, Map<String, Object> properties)
      throws ExecutionException, InterruptedException, IOException {
    return setUser(uid, properties, new DateTime());
  }
680131
public void setProperties( Map<String,String> properties ) {
        Map<String,String> userProperties = systemSession.getUserProperties();
        if ( userProperties == null ) {
            userProperties = new HashMap<String,String>();
        }
        userProperties.putAll( properties );
        
        log.debug( "Session userProperties: {}", userProperties );
        
        systemSession = (MavenRepositorySystemSession)systemSession.setUserProperties( userProperties );
        
    }
521113
public UserEntity findUserById(String userId) {
    checkAuthorization(Permissions.READ, Resources.USER, userId);
    return getDbEntityManager().selectById(UserEntity.class, userId);
  }
1035389
private static String checkUserIdentifier(final FormItemList formItemList,
			final CreateUserResponse createUserResponse) {
		final String userId = formItemList
				.getField(ProtocolConstants.Parameters.Create.User.USER_IDENTIFIER);
		if (userId != null) {
			final Node user = NeoUtils.getUserByIdentifier(userId);
			if (user == null) {
				return userId;
			}

			createUserResponse.userIdentifierInvalid(userId);
		} else {
			createUserResponse.userIdentifierMissing();
		}

		return null;
	}
1346371
public User getUser(String userName) {
        User result = null;
        for (User item : getUsersList()) {
            if (item.getName().equals(userName)) {
                result = item;
            }
        }
        return result;
    }
9391
public CompletableFuture<Map<InetSocketAddress, List<String>>> getRpcNodeWebSocketAddresses(final Serializable userid) {
        CompletableFuture<Collection<InetSocketAddress>> sncpFuture = getRpcNodeAddresses(userid);
        return sncpFuture.thenCompose((Collection<InetSocketAddress> addrs) -> {
            if (logger.isLoggable(Level.FINEST)) logger.finest("websocket found userid:" + userid + " on " + addrs);
            if (addrs == null || addrs.isEmpty()) return CompletableFuture.completedFuture(new HashMap<>());
            CompletableFuture<Map<InetSocketAddress, List<String>>> future = null;
            for (final InetSocketAddress nodeAddress : addrs) {
                CompletableFuture<Map<InetSocketAddress, List<String>>> mapFuture = getWebSocketAddresses(nodeAddress, userid)
                    .thenCompose((List<String> list) -> CompletableFuture.completedFuture(Utility.ofMap(nodeAddress, list)));
                future = future == null ? mapFuture : future.thenCombine(mapFuture, (a, b) -> Utility.merge(a, b));
            }
            return future == null ? CompletableFuture.completedFuture(new HashMap<>()) : future;
        });
    }
564037
private LDAPUser getOrCreateUser(final Entry userEntry) throws FrameworkException {

		final App app                = StructrApp.getInstance();
		final PropertyMap attributes = new PropertyMap();
		final Dn dn                  = userEntry.getDn();
		Dn parent                    = dn;

		// remove all non-structural rdns (cn / sn / uid etc.)
		while (!structuralTypes.contains(parent.getRdn().getNormType())) {

			parent = parent.getParent();
		}

		attributes.put(StructrApp.key(LDAPUser.class, "distinguishedName"), dn.getNormName());

		LDAPUser user = app.nodeQuery(LDAPUser.class).and(attributes).getFirst();
		if (user == null) {

			user = app.create(LDAPUser.class, attributes);
			user.initializeFrom(userEntry);
		}

		return user;
	}
675620
public PropertyOwner retrieveUserProperties(String strRegistrationKey)
    {
        if (this.getParentRecordOwner() != null)
            return this.getParentRecordOwner().retrieveUserProperties(strRegistrationKey);
        return null;
    }
838566
void migrateUser(Node oldUserNode) throws Exception
   {

      String userName = oldUserNode.getName();

      if (findUserByName(userName, UserStatus.ANY) != null)
      {
         removeUser(userName, false);
      }

      UserImpl user = readUser(oldUserNode);
      createUser(user, false);
   }