return AccessResult::allowedIf($routeMatch && $routeMatch->getRawParameter('user') == $account->id());
says that is depends on the current user account, but this information is not present.
Suggested fix:
$access = AccessResult::allowedIf($routeMatch && $routeMatch->getRawParameter('user') == $account->id());
$access->addCacheContexts(['user']);
return $access;
Comments
Comment #3
boobaaThanks!