public function Api::validateTokenServiceAccess in Fastly 8.3
Used to validate if an Api token has access to a service.
Return value
bool FALSE if API token does not have access to a provided Service Id.
1 call to Api::validateTokenServiceAccess()
- Api::validatePurgeCredentials in src/
Api.php - Used to validate API token for purge related scope.
File
- src/
Api.php, line 258
Class
- Api
- Fastly API for Drupal.
Namespace
Drupal\fastlyCode
public function validateTokenServiceAccess() {
if (empty($this->serviceId)) {
return FALSE;
}
$token = $this
->getToken();
if (isset($token->services) && empty($token->services)) {
return TRUE;
}
elseif (in_array($this->serviceId, $token->services, TRUE)) {
return TRUE;
}
else {
return FALSE;
}
}