Try our conversational search powered by Generative AI!

How to get list of pages by permission?



How can I get list of pages that have visible to everyone? And list of pages that only current logged in user can read (exclude pages has visible to everyone)?

Jan 03, 2017 12:11

1. Set permissions on a few pages.
2. Grab the pages as an list
3. Use the FilterForVisitor function to filter out the pages.

FilterForVisitor is a filter that removes any pages that the current user does not have access to or that is not currently published.

Good luck

Jan 04, 2017 9:35

Thank for repsonse,

FilterForVisitor is only filter pages that current user has read permission. How can I get pages that visible to everyone? I want to get list of private pages (Pages can only be seen by logged in user) and a list of public pages (Pages can be seen by everyone)? Private pages exclude Public pages.

Jan 05, 2017 12:34

FilterAccess.QueryDistinctAccessEdit() will return true for a page that match a certain accesslevel for a certain principal, and you can use the PrincipalInfo.AnonymousPrincipal to match "everyone".

FilterAccess.QueryDistinctAccessEdit(page, AccessLevel.Read, PrincipalInfo.AnonymousPrincipal)

See Episerver SDK

You could use that method to filter your lists appropriately.

Edited, Jan 05, 2017 13:46
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.