Goal
This article provides information about the functionality, configuration and workflow behind the filter by permissions feature of the Sitefinity connector.
...
Open the Sitefinity backend, create a user (your-site-domain/Sitefinity/Administration/Users)
Assign that user a role by editting the user profile or by click Assign to role
Edit the permission for that role so that the user cannot view a certain content type e.g News
Go to Content and create one blog post and one news (your-site-domain/Sitefinity/adminapp/content/newsitems)
Go to Administration → Search Indexes , create an index and reindex (your-site-domain/Sitefinity/Administration/Search)
Create a Sitefinity page and open it for editting (your-site-domain/Sitefinity/adminapp/pages)
Place the Hawksearch box and Hawksearch results widgets
Open the widget designer of each widget and click the Filter by permissions checkbox
Under Where to search choose the newly created index and save the changes
Open the page in the Frontend and search for the news that was created
...
By filtering the results on the server the request cannot be intercepted client-side therefore making sure the results cannot be seen before they were filtered.
Indexing Workflow
There are many operations that need to be executed in order to provide the user with the proper results such as filtering by permissions, paging, boosting certain results.
Filtering by Permissions
Hawksearch doesn’t hold the user’s role data so the filtering by permission is done on behalf of Sitefinity. When the Hawksearch API returns a set of results, Sitefinity checks the current user’s identity and all of the roles that are assigned to him. Then for each result that the Hawksearch API sent Sitefinity checks whether the current user is granted permissions to see them, if not that result is removed. When all of the results have been checked the final result set is sent to Hawksearch widgets.
Paging
The paging is done on behalf of Hawksearch and depends on the following parameters that Sitefinity sends : page number, max results per page, sort by. Hawksearch then uses there parameters to return the correct set of results.
Boosting
If boosting is active Hawksearch introduces a functionality to Boost and Bury certain results depending on rules that can be created in the Hawksearch Dashboard.