Try our conversational search powered by Generative AI!

Problem with displaying pages from custom ContentProvider

Vote:
 

Hi

The documentation for custom contentprovider is a little thin, and I'm stuck on this error when trying to edit the pages, and would be really grateful if someone could tell me what I'm doing wrong.

Whenever I click on the page in the treeview, and dojo makes a request I get this 500, whitout anything in the logs:

http://localhost:49819/EPiServer/cms/Stores/contentdata/3188__Doors?dojo.preventCache=1512829822676

[NullReferenceException: Object reference not set to an instance of an object.]
EPiServer.Cms.Shell.IContentExtensions.IsRootNode(ISiteDefinitionRepository siteDefinitionRepository, IContent content, SiteDefinition currentSiteDefinition) +25
EPiServer.Cms.Shell.UI.Rest.Models.Transforms.Internal.ContentDataStoreModelTransform.GetAccessRights(IContent content) +60
EPiServer.Cms.Shell.UI.Rest.Models.Transforms.Internal.<>c__DisplayClass14_0.<GetExistingLanguageBranches>b__0(CultureInfo l) +291
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +164
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +170
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +331
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +315
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +259
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) +256
Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) +785
EPiServer.Framework.Serialization.Json.Internal.JsonObjectSerializer.Serialize(TextWriter textWriter, Object value) +51
EPiServer.Shell.Services.Rest.RestResultBase.ExecuteResult(ControllerContext context) +204
EPiServer.Shell.Services.Rest.RestResult.ExecuteResult(ControllerContext context) +18
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +56
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +52
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +173
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
EPiServer.Shell.Services.Rest.RestControllerBase.EndExecute(IAsyncResult asyncResult) +38
EPiServer.Shell.Services.Rest.RestHttpHandler.EndProcessRequest(IAsyncResult result) +28
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9987157
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

The code for setting ACL:

var contentSecurable = content as IContentSecurable;

if (contentSecurable == null)
return;

var contentAcl = GetContentACL(content, parentLink);

var securityDescriptor = contentSecurable.GetContentSecurityDescriptor().CreateWritableClone() as IContentSecurityDescriptor;

if (securityDescriptor == null)
return;

securityDescriptor.IsInherited = contentAcl.IsInherited;
securityDescriptor.ContentLink = contentAcl.ContentLink;
securityDescriptor.Creator = "Gryphon";

if (securityDescriptor.IsInherited)
return;

securityDescriptor.Clear();
securityDescriptor.ContentLink = content.ContentLink;
foreach (var keyValuePair in contentAcl)
{
securityDescriptor.AddEntry(keyValuePair.Value);
}

// Pär

#186030
Dec 09, 2017 15:39
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.