CC
-
5/18/2012 2:11:41 PM
RE:Scheduled Task Permissions
The code in the scheduled task is very straightforward. All of this code works as expected: // productImport contains values to set on document TreeNode newNode = TreeNode.New(classname); newNode.SetValue("value1", productImport.Value1); newNode.SetValue("value2", productImport.Value2); // etc newNode.DocumentCulture = CultureHelper.DefaultCulture.Name; DocumentHelper.InsertDocument(newNode, parentNodeID, new TreeProvider());
All of that works, and my new node is created with the correct values. Then:
bool? success = document.CreateDefaultSKU();
This always returns false, and in the Event Log I get the following:
Event code: CREATEDEFAULTSKU Description: Message: User is not authorized for creating products. Stack Trace:
I get the same error if I configure the document type to always create an e-commerce Product when a new document is created.
As Administrator, I can go through CMSDesk and create a new document, and it will correctly create the related Product. Also, for the nodes created by the scheduled task, as Administrator I can edit them and create Products.
It is only when using the API through a scheduled task that the creation of the Product fails.
|