8

We are updating component field while publishing the component, eg. When the component is getting published we want to update current date time to PublishDate field of the component. We have written this code in .net assembly(c#). While publishing component is getting failed with an error "You do not have permission to perform this action"

We used to do this in vbscript templates but we are migrating to compound template there we are facing this issue.

user1453602
  • 1,165
  • 5
  • 14
  • 3
    PublishDate is available as a system property in the item's metadata (after publishing), and I would seriously recommend that you do this instead of changing content of components on publishing - I've seen many concurrency issues here when used with multi-threaded publishers – Nuno Linhares Dec 13 '12 at 12:42
  • 2
    I am with Nuno here. Also imagine the scenario where you publish using the two different scheduling phases. Publishing not necessarily happens at the same time of deployment. Unless of course you need the published date from the CMS and not the date when the component made it to the "live" repository. Anyways, I normally try to avoid this, for many reasons, but Nuno's I think is good enough, right? – Jaime Santos Alcón Dec 13 '12 at 17:40

3 Answers3

13

Tridion 2011 no longer allows publishing or editing other items from templating code by default.

However, it can be activated by modifying the allowWriteOperationsInTemplates attribute on the Tridion.ContentManager.Config file:

<tridion.contentmanager.security allowAutomaticUserCreation="true" hideOrganizationalItemsNoAccess="false" allowWriteOperationsInTemplates="true">
Puntero
  • 2,310
  • 15
  • 18
3

I believe that out of the box Tridion 2011 does not allow the templates to make any changes to items. This behavior can be overridden in the configuration. If anyone would know how to do this exactly, please add the info, since I cannot find it in the docs.

Quirijn
  • 3,549
  • 15
  • 30
-1

It was while we come across with bundle creation using Templating code we found that TOM.NET API is not allowing that as it is read only.

Hence, By modifying the allowWriteOperationsInTemplates attribute on the Tridion.ContentManager.Config file:

tridion.contentmanager.security allowAutomaticUserCreation="true"

It allows us to create artifacts using TOM.Net API.

Thanks ! Hiren Mistry

Hiren Mistry
  • 414
  • 2
  • 9