Serializes entities inside BackendlessUser properties.

@param user BackendlessUser whose properties need to be serialized
765984
public static void serializeUserProperties( BackendlessUser user )
  {
    Map<String, Object> serializedProperties = user.getProperties();

    Set<Map.Entry<String, Object>> properties = serializedProperties.entrySet();
    for( Map.Entry<String, Object> property : properties )
    {
      Object propertyValue = property.getValue();
      if( propertyValue != null && !propertyValue.getClass().isArray() && !propertyValue.getClass().isEnum() && !isBelongsJdk( propertyValue.getClass() ) )
      {
        property.setValue( serializeToMap( propertyValue ) );
      }
    }

    user.setProperties( serializedProperties );
  }
469898
public static Function<RequestEnvelope, String> userId() {
        return r -> Optional.ofNullable(r).map(RequestEnvelope::getContext)
                .map(Context::getSystem)
                .map(SystemState::getUser)
                .map(User::getUserId)
                .orElseThrow(() -> new PersistenceException("Could not retrieve user ID from request envelope to generate persistence ID"));
    }
493420
protected RestletUtilUser buildRestletUserFromSparqlResult(final String userIdentifier, final BindingSet bindingSet)
    {
        // log.info("result={}", bindingSet);
        
        String userEmail = bindingSet.getValue("userEmail").stringValue();
        // TODO: When hashed, need to unhash here
        char[] userSecret = null;
        if(bindingSet.hasBinding("userSecret"))
        {
            userSecret = bindingSet.getValue("userSecret").stringValue().toCharArray();
        }
        String userFirstName = null;
        if(bindingSet.hasBinding("userFirstName"))
        {
            userFirstName = bindingSet.getValue("userFirstName").stringValue();
        }
        String userLastName = null;
        if(bindingSet.hasBinding("userLastName"))
        {
            userLastName = bindingSet.getValue("userLastName").stringValue();
        }
        
        return new RestletUtilUser(userIdentifier, userSecret, userFirstName, userLastName, userEmail);
    }
1362796
@Override
	public synchronized ID removeOnline(final USER user)
	{
		final ID sessionId = super.removeOnline(user);
		if (sessionId != null)
		{
			sessionIdToSession.remove(sessionId);
		}
		return sessionId;
	}
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;
    }
1317538
@Override
    public void addUser(ApiBaseUser user) {
        try {
            room.addUser(CommandUtil.getSfsUser(user, api));
        } catch (SFSJoinRoomException e) {
            throw new IllegalStateException(e);
        }
    }
833711
public String serializeNowFromMap(@Nullable String user, long duration, @Nullable Arr roles, Map<String, Object> nameAndValMap) {
		return createNowFromMap(user, duration, roles, nameAndValMap).serialize();
	}
980269
@Override
	protected void unserializeFrom(RawDataBuffer in)
    {
        super.unserializeFrom(in);
        userName = in.readNullableUTF();
        password = in.readNullableUTF();
        clientID = in.readNullableUTF();
    }
1201393
protected void addUserToRole(String user, String role) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, CLASS_NAME + "addUserToRole", new Object[] { user, role });
        }
        Set<String> usersForTheRole = roleToUserMap.get(role);
        if (usersForTheRole != null) {
            usersForTheRole.add(user);
        } else {
            usersForTheRole = new HashSet<String>();
            usersForTheRole.add(user);
        }
        roleToUserMap.put(role, usersForTheRole);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, CLASS_NAME + "addUserToRole");
        }
    }
231030
private static UserIdentifier createUserIdentifier(
      OfflineDataUploadUserIdentifierType identifierType, String value)
      throws UnsupportedEncodingException {
    // If the user identifier type is a hashed type, also call hash function
    // on the value.
    if (HASHED_IDENTIFIER_TYPES.contains(identifierType)) {
      value = toSHA256String(value);
    }
    UserIdentifier userIdentifier = new UserIdentifier();
    userIdentifier.setUserIdentifierType(identifierType);
    userIdentifier.setValue(value);
    return userIdentifier;
  }
1095601
private UserEntity ensureRolesFetched(final UserEntity user)
	{
		if (user != null)
			user.getRoles().stream().map(r -> r.getId()).collect(Collectors.toList());

		return user;
	}
777037
public static void initialize(Object backend,
            BackendInstanceSpec backendInstanceSpec)  {
        assert backend != null : "backend cannot be null";
        assert backendInstanceSpec != null :
            "backendInstanceSpec cannot be null";
        for (Method method : backend.getClass().getMethods()) {
            if (method.isAnnotationPresent(BackendProperty.class)) {
                try {
                    BackendProperty annotation =
                            method.getAnnotation(BackendProperty.class);
                    String propertyName = propertyName(annotation, method);
                    Object propertyValue =
                            backendInstanceSpec.getProperty(propertyName);
                    if (propertyValue != null) {
                            method.invoke(backend,
                                    new Object[]{propertyValue
                                });
                    }
                } catch (IllegalAccessException | InvalidPropertyNameException | InvocationTargetException ex) {
                    throw new AssertionError(ex);
                }
            }
        }
    }
1210755
private function initializeBackEnd()
    {
        $backEndUser =
            \Tx_Oelib_BackEndLoginManager::getInstance()->getLoggedInUser(\Tx_Oelib_Mapper_BackEndUser::class);
        $this->languageKey = $backEndUser->getLanguage();
    }
683591
public static @Nonnull ApiTokenStats load(@Nonnull User user) {
        // even if we are not using statistics, we load the existing one in case the configuration
        // is enabled afterwards to avoid erasing data
        
        ApiTokenStats apiTokenStats = null;
        
        File userFolder = user.getUserFolder();
        if (userFolder != null) {
            apiTokenStats = internalLoad(userFolder);
        }
        
        if (apiTokenStats == null) {
            apiTokenStats = new ApiTokenStats();
        }
        
        apiTokenStats.user = user;
        
        return apiTokenStats;
    }
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 );
        
    }
1227346
public Request<User> create(User user) {
        Asserts.assertNotNull(user, "user");

        String url = baseUrl
                .newBuilder()
                .addPathSegments("api/v2/users")
                .build()
                .toString();
        CustomRequest<User> request = new CustomRequest<>(this.client, url, "POST", new TypeReference<User>() {
        });
        request.addHeader("Authorization", "Bearer " + apiToken);
        request.setBody(user);
        return request;
    }
1226359
@Override
	protected void serializeTo(RawDataBuffer out)
    {
        super.serializeTo(out);
        out.writeInt(consumerId.asInt());
        DestinationSerializer.serializeTo(destination, out);
        out.writeNullableUTF(messageSelector);
        out.writeBoolean(noLocal);
    }