Access Rights and newslist control

Hi, I want to apply access rights to news articles so that only members of certain groups can view the articles, but I want all users (including anonymous) to see the article title in the newslist but when clicked on they get a "You must be logged in/registered message" Any ideas? Cheers, Steve
Feb 17, 2006 15:10
Well, it depends how you bind your newslist. One option is to use the GetChildren from the Datafactory class and set NoAccess as the last parameter like this: YourPreviewNewslist.DataSource = EPiServer.Global.EPDataFactory.GetChildren(Configuration.StartPage, EPiServer.Security.AccessControlList.NoAccess) If the user clicks on the newslink the logon screen will appear. Will this solve your request ? /Øyvind
Feb 20, 2006 13:54
Thanks, but that won't solve my problem. What I want to do is show all news items/menulist items & unifiedFileSystem files irrespective of their security permissions but control what happens when an item is clicked on depending upon the security permissions. Regards, Steve
Feb 21, 2006 12:08
OK. I've got this working with the unifiedFileSystem by using the unifiedDirectory (with the AccessControlList.NoAccess parameter) as the datasource for a datalist, but I can't get the newslist to work in the same way using the getchildren method with the AccessControlList.NoAccess parameter as the datasource. The newslist control isn't displayed at all if I don't set a value for PageLinkProperty, and when I do only articles that a user is authorised to are displayed. Any ideas? Regards, Steve
Feb 28, 2006 16:45
You cannot use the PageLinkProperty at the same time you want to control the contents by using the GetChildren method. Set the list controls DataSource to the PageDataCollection you get from the GetChildren method and databind it. /Steve
Feb 28, 2006 19:40
Steve, That's exactly what I did, but nothing in the newslist control was displayed, not header, footer, nothing. Is there anything obvious I might be doing wrong? Regards, Steve
Mar 01, 2006 10:24
Problem solved. Schoolboy error I'm afraid. There was a typo in the pagelink in the code behind. Thanks for all you help. Steve.
Mar 01, 2006 10:50
* 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.