AI OnAI Off
I found the solution:
var pageAccessFilter = EPiServer.Find.SearchClient.Instance.BuildFilter<PageType>();
List<string> userRoles = Roles.GetRolesForUser().ToList();
userRoles.Add( "Everyone" );
foreach( string role in userRoles )
pageAccessFilter = pageAccessFilter.Or( x => x.RolesWithReadAccess().Match( role ) );
.Filter( pageAccessFilter )
Hi,
Looks good. I just want to add for future reference that the CMS 7 integration has quite a lot of functionality built in for filtering by publication status and access rights. Most significantly the FilterForVisitor methods.
Is there a way to filter a search result based on a specific user's access rights?
I have found this which filters based on 1 group:
What I need is to filter on multiple groups (all groups that the current users has) like: