How to know a user can access node/{nid} and node/{nid}/latest in fastest way I have a view displaying list of latest node revisions. 

The view has title field. 

The website gives users permissions to access node/{nid}(shows latest revision if published default revision doesn't exist) and node/{nid}/latest (shows latest revision if defaut revision and latest revision is different) depending moderation state and user groups.

I want to override the view's title field according to the rules below:


if current user can access node/{nid}/latest the title links to the page
else if current user can access node/{nid} the title links to the page
else show only title text


Dozens or hundreds of people may simultaneously access the view so I want to keep it fast to display. What is the fastest way to check those? 

edit: 
I searched about hook_node_grants but it only supports view/update/delete operations so I think it can't hold data for node/{nid}/latest.
Should I store every pattern in table just like node_access table does and look up on it when view is updated?
If you know the route name you can check access in PHP. For the second link you can use this route:

\Drupal::service('access_manager')-&gt;checkNamedRoute('entity.node.canonical', ['node' =&gt; '1'])). 

You can find the first one with the help of the Devel module when you click on Current Route Info while displaying the content and look for [_route].

I would put the nid into the title field and override the field content in a preprocess hook. Display the link for each route if the access check returns true. Caching is no problem because caching is by default permission based.