You are here

public function AddReminder::access in JSON:API Resources 8

Performs custom access checks for the route.

Parameters

\Drupal\user\UserInterface $user: The user from the route.

Return value

\Drupal\Core\Access\AccessResult Allowed if the currently authenticated user is the same as the user loaded via a route parameter, FALSE otherwise.

1 string reference to 'AddReminder::access'
jsonapi_resources_test.routing.yml in tests/modules/jsonapi_resources_test/jsonapi_resources_test.routing.yml
tests/modules/jsonapi_resources_test/jsonapi_resources_test.routing.yml

File

tests/modules/jsonapi_resources_test/src/Resource/AddReminder.php, line 90

Class

AddReminder
Processes a request to create a reminder node for a user.

Namespace

Drupal\jsonapi_resources_test\Resource

Code

public function access(UserInterface $user) {
  return AccessResult::allowedIf($user
    ->id() === $this->currentUser
    ->id())
    ->cachePerUser();
}