You are here

public function Api::validatePurgeCredentials in Fastly 8.3

Used to validate API token for purge related scope.

Return value

bool TRUE if API token is capable of necessary purge actions, FALSE otherwise.

File

src/Api.php, line 282

Class

Api
Fastly API for Drupal.

Namespace

Drupal\fastly

Code

public function validatePurgeCredentials() {
  if (empty($this->apiKey) || empty($this->serviceId)) {
    return FALSE;
  }
  if ($this
    ->validatePurgeToken() && $this
    ->validateTokenServiceAccess()) {
    return TRUE;
  }
  return FALSE;
}