You are here

public function SavedSearch::getAccessToken in Search API Saved Searches 8

Generates an access token specific to this saved search.

This can be used for access checks independent of a user account (for instance, for accessing a saved search via mail – especially for anonymous users).

Parameters

string $operation: The operation to perform on the saved search entity. The returned token will be only valid for this operation.

Return value

string The access token for executing the given operation on this search.

Overrides SavedSearchInterface::getAccessToken

1 call to SavedSearch::getAccessToken()
SavedSearch::urlRouteParameters in src/Entity/SavedSearch.php
Gets an array of placeholders for this entity.

File

src/Entity/SavedSearch.php, line 556

Class

SavedSearch
Provides an entity type for saved searches.

Namespace

Drupal\search_api_saved_searches\Entity

Code

public function getAccessToken($operation) {
  $key = $this
    ->getEntityTypeId() . ':' . $this
    ->id() . ':' . $operation;
  return Crypt::hmacBase64($key, Settings::getHashSalt());
}