Site structure
Version 5.x > Site structure > Can newsletter issues be viewed anonymous? View modes: 
User avatar
Member
Member
olaf-elan - 11/16/2010 7:59:58 AM
   
Can newsletter issues be viewed anonymous?
Hi,

I want to post emails to subscribed users.
If they cannot view their received email I want to link to the corresponding news issue. This looks like common practice.
This works fine with macro's

I getsomething like this:

http://[domainname]/CMSModules/Newsletters/CMSPages/GetNewsletterIssue.aspx?issueId=95


But.... it only works when i am logged on! (global administrator)
E-mail recepients are anonymous. I do not want them to log on to view this.

Where and how do i configure rights so anonymous users can view newsletter issues?

I already tried [cmssitemanger]->administration->rights->modules (newsletter)
read checked.

But this is only the setting for cmsdesk.

Any ideas?




User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 11/16/2010 9:23:24 AM
   
RE:Can newsletter issues be viewed anonymous?
Hi,

to show static newsletters on a live site you can use the Newsletter Archive webpart. To display issues in this webpart you need to check Show newsletter issue in archive box. You can find this box in the right corner while editing the newsletter issue.

Is this solution suitable for you?

Best regards,
Ivana Tomanickova

User avatar
Member
Member
olaf-elan - 11/16/2010 9:50:20 AM
   
RE:Can newsletter issues be viewed anonymous?
Hi Ivana,

I don't use webparts, but write my own templates in code.

Since emails are received in mailclients i must have an url to deeplink to.

I thought i could refer to cmsmodules/newsletters/cmspages/GetNewsletterIssue.aspx

In web.config it is authorized:

<location path="Newsletters/CMSPages">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>


The webpart scenario is way too complicated if started with code already.





User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 11/17/2010 3:10:49 AM
   
RE:Can newsletter issues be viewed anonymous?
Hi,

You can modify following condition in file: /CMSModules/Newsletters/CMSPages/GetNewsletterIssue.aspx.cs to enable anonymous users read an issue.

if (CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Newsletter", "Read"))

You can add for example a query parameter into your link to newsletter inside the template and check if URL contains this parameter instead of checking reading permission of current user.

Best regards,
Ivana Tomanickova

User avatar
Member
Member
olaf-elan - 11/17/2010 3:28:31 AM
   
RE:Can newsletter issues be viewed anonymous?
Hi Ivana,

This is excactly the line of code I have been testing on already. Completely removing this user-test makes it public anyhow.
It sure will do the trick, but i see it as a hack. I see some security issues in some cases where authentication is required.

Since any update of kentico may overwrite this document it also leaves me with a maintenance problem.

Also other websites running on the same Kentico instance may refer to this (unaltered code)

I hoped there was a url parameter already that I wasn't aware of.


Thank you for your help so far.


User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 11/17/2010 5:36:52 AM
   
RE:Can newsletter issues be viewed anonymous?
Hi,

alternatively you can create your custom page with the same code as GetNewsletterIssue a place it outside CMSModules folder. This way standard code does not have to be modified.

Best regards,
Ivana Tomanickova