Try our conversational search powered by Generative AI!

Custom filtering to find all files under accessible folder


I'm building a searching page, where could find all document including pdf, word, excel ... now it's working well, however some folders are just accessible by some particular users/groups, so all documents under these folders should not be shown in the search result.

Now, we are post-processing the result list, and check permission of parent folder, if current user doesn't have permisson to read that folder, the result should be removed from list. However the paging is not working properly, because total result is wrong, and number of displaying item on each page is not consistent. We are changing the implementation to build a custom filter, to check parent folder permission, and just get relevant item from EPi find, we don't know how to do that with EPi Find client, anyone please help to solve that problem 

Aug 25, 2016 11:00

For filtering on access rights there is an extension method for that

    .For("Possibly secret stuff")
    .Filter(x => x.RolesWithReadAccess().Match("Everyone"))
Aug 25, 2016 13:25

Thanks @Daniel for your quick answer, however it's checking for current item, what I'm looking for is checking parent folder permission, not current item

Aug 26, 2016 4:54

Then I would either make sure the current items actually have those access rights. Since they are normally inherited that should be easy but maybe you have some reason why you are not using that?

Otherwise I would create a new separate field on the indexed file for that logic and filter on that.

Aug 26, 2016 9:30

Hi Daniel, actually the search page is working for File searching, including PDF and Word document file, so we have to base on folder permisson instead of File permission

Aug 26, 2016 11:38

Ok, don't know how you store the files but in normal Episerver solutions you can set access rights on the files as well from the file manager and then use Find to filter them. Then you get out of the box support for that.

Aug 26, 2016 12:19

Hi Daniel, in my current website, we are setting access rights on folder level, not on an individual file, because there are a lot of file in the existing site.

Aug 26, 2016 12:48

That's good. But if you set them on the folder they will also be inherited to the file itself. So the expression above should work if I'm not missing anything here... 

Aug 26, 2016 14:30

Hi Daniel, I tried to set permission on the folder, and checked the permission on EPi Find, it worked well for folder, however the permission for all files belong to that folder didn't change on EpiFind

Aug 29, 2016 12:41

Try reindex the file either by publishing it again or run the job. Then you can check access rights of the file first in Episerver and then in Episerver find index browser. Should be inherited in both.

Aug 30, 2016 6:25
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.