GetPage for visitor?
I started working with EPiServer CMS 5 four months ago and I really like it. It's performance (good analyze of it you can find here) is much better then EPiServer 4.6x and there are few breaking changes that makes developers work easier. One of them is new filter: FilterForVisitor (described at the end of article at episerver.com ). It takes as an argument PageDataCollection and filter out pages that visitor has no right to see:
PageReference listingContainer = CurrentPage["RssSource"] as PageReference; PageDataCollection children = GetChildren(listingContainer); FilterForVisitor.Filter(children);
Cool but... it works only with PageDataCollections. It would be great if there was method that takes as an argument PageData object (or in ideal world PageReference) and checks if visitor can see it. Now if I want to check it I have to do something like this:
PageReference pageRef = new PageReference(someId);
PageData tmpPage = EPiServer.DataFactory.Instance.GetPage(pageRef, AccessLevel.NoAccess);
if( tmpPage.QueryDistinctAccess( AccessLevel.Read ) )
return tmpPage;
else
return null;
Why GetPage with argument AccessLevel.Read - could not return null if visitor has no right to see it? Yes - I know that it will throw exception but making flow of application with catch block isn't that nice.
Does anyone know better way of doing check if visitor can access page?
March 11th, 2008 - 12:11
very very nice article
March 12th, 2008 - 21:36
Nice one. Welcome to the blogosphere