Limit access to webview of a doctype

In the doctype creation page if we tick the “has web view” option, a template folder will be created with files:

  • doctypename_row.html
  • doctypename.html

The _row file is used to display the list of documents, while the other file is to display the full content.

How do I limit the access to the full display to login user only?
So user can see the list but when clicking on a list/card (when not loggedin) will display a message telling to login.
Thank you