code: private Node getUserNode(Session session, UserImpl user) throws RepositoryException
     {
        if (user.getInternalId() != null)
        {
           return session.getNodeByUUID(user.getInternalId());
        }
        else
        {
           return utils.getUserNode(session, user.getUserName());
        }
     }
docs: Returns user node by internal identifier or by name.