Thanks for the responses.
@Juraj, The code we are using is the same code that we've used on other sites for creating pages programmatically (e.g. via Scheduled Tasks, or a custom importer) that we have used in the CMS application, but this time using in the MVC site, we have a POST method linked to an online form that is creating the offer page. It does include @Trevor's change for adding in a admin user (the user variable comes from the calling method) but adding this hasn't changed what is happening. It has changed who the owner of the node is, however the security issue is still occurring.
private static Offer CreateOfferPage(UploadOfferRequestModel request,
DateTime startDate, DateTime endDate,
Supplier supplier, UserInfo user)
{
using (CMSActionContext context = new CMSActionContext()
{
User = user,
}
)
{
var offer = new Offer();
offer.DocumentCulture = "en-GB";
offer.SetValue("DocumentPageTemplateConfiguration", new PageTemplateConfigurationSerializer().Serialize(new PageTemplateConfiguration
{
Identifier = $"{Offer.CLASS_NAME}_Default",
}));
offer.Name = request.Offer;
offer.DocumentName = request.Offer;
offer.BannerTheme = "white";
offer.BannerHeight = "reduced";
offer.OfferDetails = request.OfferDetails;
offer.OfferTagline = request.OfferHeadline;
offer.OfferStartDate = startDate;
offer.OfferEndDate = endDate;
offer.DocumentPublishTo = endDate;
offer.Insert(supplier);
return offer;
}
}
I haven't tried this on the Dancing goat site yet as I have been on annual leave, I will update the question when I have attempted.