...
...
...
...
...
...
Goal
This article provides information about the functionality, configuration and workflow behind the filter by permissions feature of the Sitefinity connector.
Prerequisite
Info |
---|
Configured Connector - Configure Hawksearch Connector: Applying Settings |
Steps to configure filtering by Permissions
Open the Hawksearch Settings: Administration → Settings → Hawksearch and select Filter By Permissions checkbox.
Open the Sitefinity backend and create a role under (your-site-domain/Sitefinity/Administration/Roles)
Open the Sitefinity backend, create a user under (your- Sitefinity permissions overviewsite-domain/Sitefinity/Administration/Users)
Assign that the user a role by editting the user profile or by click Assign to rolethe newly created role
Go to Content and create one blog post and one news article
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)
the News article you created
In the right side menu on the News page open Set permissions
Under who can view news press Change
Check the advanced checkbox and add the role(s) you wish to deny
5. Go to Administration → Search Indexes , create an index and reindex (your-site-domain/Sitefinity/Administration/Search)
6. Create a Sitefinity page and open it for
...
editing (your-site-domain/Sitefinity/adminapp/pages)
7. Place the Hawksearch box and Hawksearch results widgets
8. Open the widget designer of each widget and click the Filter by permissions checkbox
9. Under Where to search? choose the newly created index and save the changes
10 .Login as the newly created user
11. Open the page in the
...
frontend and search for the
...
Note |
---|
If you have an existing index it is not necessary to create a new one. |
...
content you created - it should not be visible
Info |
---|
The Hawksearch config exposes a checkbox which specifies whether permissions and denials fields should be added to each document that is being indexed. These fields specify which user roles are permitted to view the document and which are denied. This checkbox is selected by default. |
How it works
...
Search Workflow
Info |
---|
When filtering is active the connector exposes endpoints for the search and autocomplete queries requests making it work as a proxy, so all of the search and autocomplete request are sent directly to Sitefinity. |
Typing in the search box sends a request to Sitefinity’s autocomplete endpoint, searching sends a request to Sitefinity’s search endpoint.
On it’s its end Sitefinity makes a server-side call to the Hawksearch API with the following parameters :
...
Client ID, Index name, Keyword, Page number, Sort By, Boost and Bury etc.
Query - contains information about the current user roles
3. The Hawksearch API then responds with a set of results depending on the parameters sent
3. Sitefinity then resolves the current user’s identity and evaluates the permissions he has
4. The user’s permissions are then used to filter the set of results server-side
5. After the filtering is completed the results are displayed to the user though the Hawksearch results widget.
...
:
It uses the Query parameter to determine which results should be sent back - it compares the user roles to the permission and denials for each result. If the user is denied access to a specific result it is not sent back.
4. Sitefinity then passes these results to the Hawksearch results widget to be displayed on the frontend
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
...
Indexing
When the index is created and Filter by Permissions is turned on in the Hawksearch configuration each document is sent with fields specifying users in which roles are permitted to view the document and users in which roles and / or the user id are not allowed to view it. As mentioned in the Search Workflow when a search request is made it contains the roles of the user making the request. Hawksearch then compares these roles with the permissions of each document and determines whether the user can view the document.
Documents are having permissions field with the ids:
...
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.
...