Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » Getpermissionforuser error in version 9.15.6

Getpermissionforuser error in version 9.15.6

Andreas Pettersson
Reply

Hi,

I render an itemlist using this one. But it got an error on the site

 

Error:

Error executing template "Designs/app/master/navigationDesignHeader.cshtml"
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Dynamicweb.Content.ParagraphPermissionService.GetPermissionForUser(User user, Int32 paragraphId, Permissions permissions, PagePermissionLevels level, Boolean includeEveryone)
   at Dynamicweb.Content.ParagraphPermissionService.GetPermissionForUser(User user, Paragraph permissionObject, PagePermissionLevels level)
   at Dynamicweb.Content.ContentPermissionHelper.HasAccess[T](T permissionObject, PagePermissionLevels pagePermissionLevel)
   at Dynamicweb.Content.ContentPermissionHelper.HasAccessToParagraph(Paragraph paragraph, PermissionLevel permission)
   at Dynamicweb.Content.Items.Queries.Repository.GetParagraphs(Boolean checkPermissions, List`1 effectiveItemTypes, List`1 allPages)
   at Dynamicweb.Content.Items.Queries.Repository.SelectByParentPageIds(IEnumerable`1 parentIds, Query query, Boolean includeParagraphs, Boolean includeChildItems, Boolean checkPermissions, Boolean includeInheritedItems)
   at Dynamicweb.ItemPublisher.Frontend.GetItems()
   at Dynamicweb.ItemPublisher.Frontend.List()
   at Dynamicweb.ItemPublisher.Frontend.GetContent()
   at Dynamicweb.ItemPublisher.Frontend.GetContentBySettings(String settings)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Dynamicweb.Extensibility.AddIns.AddInManager.InvokeFunction(Object instance, String functionName, Object[] arguments)
   at Dynamicweb.Rendering.TemplateBase`1.RenderItemList(Object settings)
   at CompiledRazorTemplates.Dynamic.RazorEngine_f861bf78d785410b9341382a555468a5.<>c__DisplayClass2_0.<RenderNewsItems>b__0(TextWriter __razor_helper_writer) in C:\local\app\Files\Templates\Designs\app\master\navigationDesignHeader.cshtml:line 121
   at CompiledRazorTemplates.Dynamic.RazorEngine_f861bf78d785410b9341382a555468a5.<>c__DisplayClass0_0.<RenderNodes>b__0(TextWriter __razor_helper_writer) in C:\local\app\Files\Templates\Designs\app\master\navigationDesignHeader.cshtml:line 19
   at CompiledRazorTemplates.Dynamic.RazorEngine_f861bf78d785410b9341382a555468a5.Execute() in C:\local\app\Files\Templates\Designs\app\master\navigationDesignHeader.cshtml:line 4
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()
 

 Anyone know what the problem is and how to fix it? 
I only seem to get this error on my local solution and not on test server.

Regards
Andreas


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

I think you have not enabled "New permission" model on your local environment... Check that in settings->controlpanel->users

Votes for this answer: 1
 
Andreas Pettersson
Reply

Thanks, works like a charm.

/Andreas

 
Rúni Gudmundarson
Reply

I'm encountering the same issue. However, I've noticed that the option to enable 'New permission' is missing from this solution. Interestingly, I have another solution running on the same version, and everything works perfectly there i can see(and check) the New permissions checkmark any suggestions ?

 

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Runi

It could be a license issue - what license is installed? And can you try to renew it maybe?

 
Rúni Gudmundarson
Reply

Ok that works but is this intentional ? While I'm running a web and ecommerce trial in my local environment, the 'New permission' model isn't available. However, when I switch to a full trial, it becomes accessible. This indicates a potential issue, as there are errors in several modules caused by the "New permission" model not being activated.

 

You must be logged in to post in the forum