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

Hiding Widget #5

Closed jptissot closed 4 years ago

jptissot commented 4 years ago

It would be a nice enhancement to be able to hide a ContentItem from flow / bag, with maybe with an optional message that would replace the widget if a user is not permitted.

jptissot commented 4 years ago

Was able to accomplish this by adding a setting "DisableRedirect" that won't redirect. This gives the widget template the ability to add custom display paths using the roles.

jptissot commented 4 years ago

If you want to copy what I did: https://github.com/StatCan/StatCan.OrchardCore/tree/master/src/Modules/Etch.OrchardCore.ContentPermissions

peterkeating commented 4 years ago

This is a really cool idea. I'm wondering if we could simply check if the content type is a widget, if so then don't do the redirect. Will definitely add the Liquid filter, that would be really useful.

jptissot commented 4 years ago

I was toying with that idea but bag items are not always widgets, so I didn't want to force a stereotype.

peterkeating commented 4 years ago

@jptissot Good point! Think I'm going to make it that if the redirect URL field is empty then no redirect will occur instead of having another field to disable the original field.

peterkeating commented 4 years ago

Thanks for the suggestion @jptissot 👍