Developer forum

Forum » Ecommerce - Standard features » PagePermissions in Content Indexer

PagePermissions in Content Indexer

John Broers
Reply

Hi,

Is there a way to verify if a visitor has access to a page using the Content Indexer and Queries? On our website, we’re restricting certain blog and news posts for logged-out users with page permission settings. However, these restricted pages are still showing up in search results. We're using a QueryPublisher app on the search page.

If something like this is currently not possible with configuration, would it be possible by writing something like an IndexExtender?

 

BR,

John Broers

PagePermissions.png

Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi John

You cannot check for permissions on query time as the permissions are inherited. When rendering the list of results, you can check them in the template:

Dynamicweb.Frontend.SecurityHandler.IsCurrentUserAllowed(Page)

If you just want to mark a document with "haspermissions" yes/no, you can do that in an indexextender. You can basically just run the above or call Page.HasPermission which is an extension you can find in Dynamicweb.Security.Permissions namespace

 

You must be logged in to post in the forum