src/Controller/Component/UserToolComponent.php
public function getUser($userId = null, $options = []) {
		$options = Hash::merge($this->getConfig('getUser'), $options);

		if (is_null($userId)) {
			if (isset($this->_getRequest()->getParam('pass')[0])) {
				$userId = $this->_getRequest()->getParam('pass')[0];
			}
		}

		$entity = $this->UserTable->getUser($userId);
		if ($options['viewVar'] !== false) {
			$this->getController()->set($options['viewVar'], $entity);
			$this->getController()->set('_serialize', [$options['viewVar']]);
		}

		return $entity;
	}
public function getUser($userId = null, $options = []) {
		$options = Hash::merge($this->getConfig('getUser'), $options);

		if (is_null($userId)) {
			if (isset($this->_getRequest()->getParam('pass')[0])) {
				$userId = $this->_getRequest()->getParam('pass')[0];
			}
		}

		$entity = $this->UserTable->getUser($userId);
		if ($options['viewVar'] !== false) {
			$this->getController()->set($options['viewVar'], $entity);
			$this->getController()->set('_serialize', [$options['viewVar']]);
		}

		return $entity;
	}
public function getUser ( $ userId = null , $ options = [ ] ) { $ options = Hash :: merge ( $ this -> getConfig ( 'getUser' ) , $ options ) ; if ( is_null ( $ userId ) ) { if ( isset ( $ this -> _getRequest ( ) -> getParam ( 'pass' ) [ 0 ] ) ) { $ userId = $ this -> _getRequest ( ) -> getParam ( 'pass' ) [ 0 ] ; } } $ entity = $ this -> UserTable -> getUser ( $ userId ) ; if ( $ options [ 'viewVar' ] !== false ) { $ this -> getController ( ) -> set ( $ options [ 'viewVar' ] , $ entity ) ; $ this -> getController ( ) -> set ( '_serialize' , [ $ options [ 'viewVar' ] ] ) ; } return $ entity ; }
Gets an user based on it's user id.

- `viewVar` it sets the entity to the view. It's set by default to `user`. To
disable setting the view var just set it to false.

@param int|string $userId UUID or integer type user id.
@param array $options Configuration options.
@return mixed
Gets an user based on it s user id .