A couple of days back I ran into an issue regarding the DevHawk Rss Syndicator and access rights on lists. Here is a link to that post.
Since it was a requirement on a portal implementation effort I was occupied for the last couple of days to find a work around for this, coz it could be a serious issue depending on how you've setup security on your SharePoint sites.
Fortunately Philip Colmer came to my rescue by pointing me out to this entry on Austin Wheats blog. Austin explains all the issues with checking user permissions via the CheckPermissions and DoesUserHavePermissions methods. And incidentally the place i was stumped at was these two methods too result in UnauthorizedAccessExceptions being thrown. Fortunately he does point to an out for that.
So just in case you guys were wondering heres the fix to DevHawk's Syndicator
private void WriteWebChannel(XmlWriter xw, SPWeb web)
{
//Write out the base RSS Channel Info
xw.WriteElementString("title", web.Title);
xw.WriteElementString("link", web.Url);
if (web.Description.Length > 0)
xw.WriteElementString("description", web.Description);
xw.WriteElementString("publisher", "http://purl.org/dc/elements/1.1/", string.Format("{0} ({1})", web.Author.Email, web.Author.Name));
xw.WriteElementString("generator", "DevHawk SharePoint Syndication");
//Iterate over the lists in the web
foreach (SPList list in web.Lists)
{
System.Diagnostics.Debug.WriteLineIf(list.Hidden, list.BaseType);
try
{
// Check if the user has rights to view the list
SPSite site = list.ParentWeb.Site;
site.CatchAccessDeniedException = false;
list.Permissions.CheckPermissions(
SPRights.ViewListItems);
if (list.Hidden)
continue;
if (!config.DisplayFeed(list))
continue;
WriteList(xw, list);
}
catch (UnauthorizedAccessException)
{
continue;
}
}
}
I hope Harry Pierson accomodates this in the next release.