EtchUK / Etch.OrchardCore.ContentPermissions

Module for Orchard Core to enable configuring access at a content item level.
MIT License
25 stars 6 forks source link

Which friend can help me? How to use this feature correctly? #23

Open uussoft opened 2 years ago

uussoft commented 2 years ago

when i add this code in the liquid template like this: `{% if Model.ContentItem | user_can_view %}

Awesome content that you have permission to view.

{% else %}

Unfortunately you're not able to view this content.

{% endif %}

{{ Model.Content.ContentsMetadata | shape_render }} {{ Model.Content.MarkdownBodyPart | shape_render }} {{ Model.Content.BlogPost-Category | shape_render }} {{ Model.Content.BlogPost-Tags | shape_render }} {{ Model.Content.CommentatorPart | shape_render }}`

run the app,throw this exception:

An unhandled exception occurred while processing the request. Exception: Failed to parse liquid file /Areas/TheBlogTheme/Views/Content-BlogPost.liquid: Invalid 'if' tag at (31:6) Source: {% if Model.ContentItem | user_can_view %} OrchardCore.DisplayManagement.Liquid.LiquidViewTemplate+<>c__DisplayClass8_0+<<ParseAsync>b__0>d.MoveNext() in LiquidViewTemplate.cs, line 98