DocumentsOnPath not working on Live Site

Matthew Osgatharp asked on May 1, 2014 09:41

We refreshed my development server from my quality server. We used a database backup of the quality database and restored it to a different SQL Server. I copied the .Net code to my development website location. After making adjustments to environment variables to set it up as Development, I didn't notice any issues. I proceeded with patching from version 7.0.24 to version 7.0.84. I proceed with some changes to my pages. When testing them, I noticed that the macros in the properties of the web parts do not appear to be executing on the Live Site. However, the preview site was executing without issue. I reenter a couple of the macros to see if it would resign them. When viewing the live site, they still didn't work. I went to the Administration>System>Macros tab on the Site Admin site. I entered my old connection string and checked Sign all Macros and Use Current Salt. I then clicked update macro signatures. I view the Live site and they still do not appear to work. The Preview site still shows they are working. There are no objects, pages, or templates checked out. So I turned on debugging for macros. I notice that the macro is executing but not returning the proper values.

The macro that I am using is {%CurrentDocument.DocumentsOnPath[2].DocumentName#%}

I added {%CurrentDocument.DocumentsOnPath.Count#%} to the same display area and it comes back as 0.

The tree is similar to below. The macro is on the master page set on the "Mobile" page. Brochure inherits the master page.

Root -Mobile --Brochures ---Brochure 1 ---Brochure 2 ---Brochure 3 ---Brochure 4

I also added {%CurrentDocument.AliasPath#%} and it returns "/Mobile/Brochures" so I know it is picking up the right document name.

I am confused on why this would work in preview and not in live site if all pages are checked in and have the green dot showing they are published.

Also, if you jump back and forth between live site and preview site (using the close button on preview site and the Live site link in the Site Manager), it suddenly works for that page. Then when I view it on another device, it works for that page but no other until I clear the cache.

The quality site that this environment was copied from shows that the macros are executing and returning the values correctly consistently.

Correct Answer

Martin Danko answered on May 2, 2014 07:25

Hello,

Could you please try to add the following key into your web.config file:

<add key="CMSCheckPermissionsForDocumentCollection" value="false"/>

Best regards, Martin

1 votesVote for this answer Unmark Correct answer

Recent Answers


Matthew Osgatharp answered on May 2, 2014 07:58

Thanks Martin. That made it work. I know see others have had to do this. I know that there is a good reason the the security was change that requires this to be set to work the old way. But does this make my instance any less secure or is there other security that I should setup for anonymous users that would also work? I just don't want to "undo" a security fix. Thanks for the help.

0 votesVote for this answer Mark as a Correct answer

Martin Danko answered on May 5, 2014 08:00

Hi Matt,

In general I don't see any problem here. It will simply allow to access the document's related collections for public users. I'm not also not sure why developers has decided to disable this by default as from my point of view, it's pretty common thing.

Best regards, Martin

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.