Tuesday, August 4, 2009

Manually checking the page permissions for a specific user on a Sitecore site

Problem description
I introduced a Google Translatation feature in the topbar of a Sitecore base website accessible both by anonymous users and registered users. The translation utility should however only be enabled on pages accessible by anonymous users since Google will not be able to translate password protected pages.

Solution description
I introduced following code snippet to help me figure out if the current page is accessible to anonymous users or not.



Together with two regular asp.net PlaceHolder's and the following code in the Page_Load method it now works as intended.


All together the site now looks like this


When the user hovers with the mouse pointer over the Google Translate icon on a page accessible by anonymous users following is shown


And when a logged in user has navigated to a page not accessible by anonymous users following is shown instead

No comments:

Post a Comment