Model/Behavior/PermitBehavior.php
public function user(Model $Model, $result, $key = null) {
		if (method_exists($Model, 'user')) {
			return $Model->user($key, $result);
		}

		if (class_exists('AuthComponent')) {
			return AuthComponent::user($key);
		}

		if (class_exists('Authsome')) {
			return Authsome::get($key);
		}

		if (method_exists($Model, 'get')) {
			$className = get_class($Model);
			$ref = new ReflectionMethod($className, 'get');
			if ($ref->isStatic()) {
				return $className::get($key);
			}
		}

		return false;
	}
public function user(Model $Model, $result, $key = null) {
		if (method_exists($Model, 'user')) {
			return $Model->user($key, $result);
		}

		if (class_exists('AuthComponent')) {
			return AuthComponent::user($key);
		}

		if (class_exists('Authsome')) {
			return Authsome::get($key);
		}

		if (method_exists($Model, 'get')) {
			$className = get_class($Model);
			$ref = new ReflectionMethod($className, 'get');
			if ($ref->isStatic()) {
				return $className::get($key);
			}
		}

		return false;
	}
public function user ( Model $ Model , $ result , $ key = null ) { if ( method_exists ( $ Model , 'user' ) ) { return $ Model -> user ( $ key , $ result ) ; } if ( class_exists ( 'AuthComponent' ) ) { return AuthComponent :: user ( $ key ) ; } if ( class_exists ( 'Authsome' ) ) { return Authsome :: get ( $ key ) ; } if ( method_exists ( $ Model , 'get' ) ) { $ className = get_class ( $ Model ) ; $ ref = new ReflectionMethod ( $ className , 'get' ) ; if ( $ ref -> isStatic ( ) ) { return $ className :: get ( $ key ) ; } } return false ; }
Wrapper around retrieving user data

Can be overriden in the Model to provide advanced control

@param Model $Model Model to use to retrieve user
@param array $result single Model record being authenticated against
@param string $key field to retrieve.  Leave null to get entire User record
@return mixed User record. or null if no user is logged in.
Wrapper around retrieving user data