src/Traits/PerformsPreFlightChecking.php
public function preflighted(): bool
    {

        // Just stop if ESI is considered down.
        if ($this->isEsiDown()) return false;

        // Ignore NPC corporations by marking the job as unauthenticated.
        // This is admittedly a little hacky, so a better way is needed
        // more long term.
        if (in_array('corporation', $this->tags()) && $this->isNPCCorporation())
            return false;

        // Public endpoints need no checking
        if ($this->isPublicEndpoint()) return true;

        // Check if the current scope also needs a corp role. If it does,
        // ensure that the current character also has the required role
        // and the corporation is not an NPC corporation.
        if (count($this->roles) > 0) {

            // Don't process NPC corporations.
            if ($this->isNPCCorporation()) return false;

            // Ensure that the character has the needed roles to make
            // a call to this endpoint.
            if ($this->isCorpCharacterWithRoles())
                return true;
            else
                return false;
        }

        // If a corporation role is *not* required, check that we have the required
        // scope at least.
        if (in_array($this->scope, $this->token->scopes))
            return true;

        // Log the deny
        Log::debug('Denied call to ' . $this->endpoint . ' as scope ' . $this->scope . ' was missing.');

        return false;
    }
public function preflighted(): bool
    {

        // Just stop if ESI is considered down.
        if ($this->isEsiDown()) return false;

        // Ignore NPC corporations by marking the job as unauthenticated.
        // This is admittedly a little hacky, so a better way is needed
        // more long term.
        if (in_array('corporation', $this->tags()) && $this->isNPCCorporation())
            return false;

        // Public endpoints need no checking
        if ($this->isPublicEndpoint()) return true;

        // Check if the current scope also needs a corp role. If it does,
        // ensure that the current character also has the required role
        // and the corporation is not an NPC corporation.
        if (count($this->roles) > 0) {

            // Don't process NPC corporations.
            if ($this->isNPCCorporation()) return false;

            // Ensure that the character has the needed roles to make
            // a call to this endpoint.
            if ($this->isCorpCharacterWithRoles())
                return true;
            else
                return false;
        }

        // If a corporation role is *not* required, check that we have the required
        // scope at least.
        if (in_array($this->scope, $this->token->scopes))
            return true;

        // Log the deny
        Log::debug('Denied call to ' . $this->endpoint . ' as scope ' . $this->scope . ' was missing.');

        return false;
    }
public function preflighted ( ) : bool { // Just stop if ESI is considered down. if ( $ this -> isEsiDown ( ) ) return false ; // Ignore NPC corporations by marking the job as unauthenticated. // This is admittedly a little hacky, so a better way is needed // more long term. if ( in_array ( 'corporation' , $ this -> tags ( ) ) && $ this -> isNPCCorporation ( ) ) return false ; // Public endpoints need no checking if ( $ this -> isPublicEndpoint ( ) ) return true ; // Check if the current scope also needs a corp role. If it does, // ensure that the current character also has the required role // and the corporation is not an NPC corporation. if ( count ( $ this -> roles ) > 0 ) { // Don't process NPC corporations. if ( $ this -> isNPCCorporation ( ) ) return false ; // Ensure that the character has the needed roles to make // a call to this endpoint. if ( $ this -> isCorpCharacterWithRoles ( ) ) return true ; else return false ; } // If a corporation role is *not* required, check that we have the required // scope at least. if ( in_array ( $ this -> scope , $ this -> token -> scopes ) ) return true ; // Log the deny Log :: debug ( 'Denied call to ' . $ this -> endpoint . ' as scope ' . $ this -> scope . ' was missing.' ) ; return false ; }
Perform a number of preflight checks for an API call.

These checks attempt to pre-empt failure conditions and
other cases where the API call might fail. Checks include
those where a token might be invalid, or insufficient
roles exists on a token to make a corporation call.

Finally, if ESI is determined to be down, this will also
fail preflight checks.

@return bool
@throws \Exception
Perform a number of preflight checks for an API call .