Gets a User instance owned by this Customer.
@param mixed $nb_user A CNabuDataObject containing a nb_user_id field or an ID.
@return CNabuUser|null Returns the required User instance if exists or null if not.
513621
public function getUser($nb_user)
    {
        $retval = null;

        $nb_user_id = nb_getMixedValue($nb_user, NABU_USER_FIELD_ID);
        if (is_numeric($nb_user_id)) {
            $nb_new_user = new CNabuUser($nb_user_id);
            if ($nb_new_user->isFetched() && $nb_new_user->validateCustomer($this)) {
                $nb_new_user->setCustomer($this);
                $retval = $nb_new_user;
            }
        }

        return $retval;
    }
657978
public function &user($user = null)
    {
        if($user) {
            $_SESSION[$this->params['session_key']] = $user;
        }
        else {
            if(!$this->check()) {
                throw new UserException('Not logged in', 403);
            }
        }


        return $_SESSION[$this->params['session_key']];
    }
311800
public function setServerId(int $nb_server_id) : CNabuDataObject
    {
        if ($nb_server_id === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$nb_server_id")
            );
        }
        $this->setValue('nb_server_id', $nb_server_id);
        
        return $this;
    }
1017064
function getUser($sid) {
		if ($this->user == null) {
			$this->user = $this->getUserFromSession($sid);
		}
        return $this->user;
    }
291344
protected function getUserEntity() : ?User
    {
        if (!$this->userEntity && $this->userId)
        {
            $this->userEntity = $this->userRepository->findOneById($this->userId);
        }

        return $this->userEntity;
    }
883553
public static function getUser()
    {
        phpCAS::_validateClientExists();

        try {
            return self::$_PHPCAS_CLIENT->getUser();
        } catch (Exception $e) {
            phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
        }
    }
233355
public function getUserEntity($user)
    {
        if (is_numeric($user)) {
            $userEntity = $this->entityTypeManager
                ->getStorage('user')
                ->load($user);
        } else {
            $userEntities = $this->entityTypeManager
                ->getStorage('user')
                ->loadByProperties(['name' => $user]);
            $userEntity = reset($userEntities);
        }

        return $userEntity;
    }
718908
public function getAuthor()
    {
        $user = null;

        if($this->hasProperty('created_by') && !empty($this->created_by)) {
            $user = $this->getObject('user.provider')->getUser($this->created_by);
        }

        return $user;
    }
473699
final public function isOwner(CM_Model_User $user = null) {
        try {
            return $this->getUser()->equals($user);
        } catch (CM_Exception_Nonexistent $ex) {
            return false;
        }
    }
168635
function get_network_user() {
            if ( ! $this->_is_network_active ) {
                return null;
            }

            return FS_User::is_valid_id( $this->_storage->network_user_id ) ?
                self::_get_user_by_id( $this->_storage->network_user_id ) :
                null;
        }
1252954
public function setUserGroupTypeId(int $nb_user_group_type_id) : CNabuDataObject
    {
        if ($nb_user_group_type_id === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$nb_user_group_type_id")
            );
        }
        $this->setValue('nb_user_group_type_id', $nb_user_group_type_id);
        
        return $this;
    }
193132
public function getUserMainDomain(User $user) {
    if($this->domainEnabled) {
      $groups = Group::getUserGroup($user);
      if (is_array($groups)) {
        foreach ($groups as $group) {
          if ($domaine = $group->getDomain()) {
            if ($domaine->status()) {
              return $domaine;
            }
          }
        }
      }
    }
    return NULL;
  }
817882
protected function getUser()
    {
        trigger_error('DrupalSubContextBase::getUser() is deprecated. Use RawDrupalContext::getUserManager()->getCurrentUser() instead.', E_USER_DEPRECATED);

        $user = $this->getUserManager()->getCurrentUser();

        if (empty($user)) {
            throw new \Exception('No user is logged in.');
        }

        return $user;
    }
554322
public function getUserEntity($user)
    {
        $result = null;
        if ($user instanceof UserEntity) {
            $result = $user;
        } else {
            $u = $this->getUser($user);
            if ($u !== null) {
                $result = $this->app->make(EntityManager::class)->find(UserEntity::class, $u->getUserID());
            }
        }

        return $result;
    }
958358
public static function getCurrentUser() {
    $email = UserServiceUtil::getUserEnvironmentVariable('USER_EMAIL');
    $userId = UserServiceUtil::getUserEnvironmentVariable('USER_ID');
    $federatedIdentity =
        UserServiceUtil::getUserEnvironmentVariable('FEDERATED_IDENTITY');
    $federatedProvider =
        UserServiceUtil::getUserEnvironmentVariable('FEDERATED_PROVIDER');

    if (!$email && !$federatedIdentity) {
      return null;
    }

    if (!$federatedIdentity) {
      $federatedIdentity = null;
    }

    if (!$federatedProvider) {
      $federatedProvider = null;
    }

    // We set this to maintain compatibility with the
    // datastore_types.FromPropertyPb creation of a User object, which will set
    // an empty string for the email (since it is a required field of the
    // underlying data representation of this class in the datastore.
    if ($email === false) {
      $email = '';
    }

    // User.user_id() should only return a
    // string of length > 0 or null.
    if (!$userId || $userId == '') {
      $userId = null;
    }

    return new User($email, $federatedIdentity, $federatedProvider, $userId);
  }
554979
public function getUser() {
        $token = null;
        if (null === $this->user) {
            $token = $this->getTokenStorage()->getToken();
        }
        if (null !== $token) {
            $this->user = $token->getUser();
        }
        if (true === ($this->user instanceof UserInterface)) {
            return $this->user;
        }
        return null;
    }
557126
public function getUser() : ?User
    {
        $key = $this->getUserId();

        if (empty($key)) {
           return null;
        }

        return User::Store()->getById($key);
    }