This project is read-only.

ContentPart Display

Topics: Customizing Orchard, General, Writing modules
Jun 17, 2011 at 6:43 PM


I have created several custom contentparts in my module.

They all have editor templates for admin. Now I've started to implement end-user pages.

I would like to display some of the properties only for admin not for end users (i.e. Approved checkbox)

What's the appropriate way to do this? Separate contentparts for admin and for end-user? If not, how will driver decide what to show?

Thank you.

Jun 17, 2011 at 7:10 PM

You should check one of the permissions from Orchard.Framework. I'd say probably site owner. You could either check it from the template or add a specific property on the shape that the template code can look at to decide what to display. If it's the whole part that shouldn't be displayed, the easiest is probably to do it from the driver and just return a new empty ShapeResult when permissions don't match.

Jun 17, 2011 at 7:19 PM

Thank you very much Bertrand.

Jun 17, 2011 at 7:42 PM

You can also implement IPermissionProvider if you want to define your own custom permissions to create more granular admin roles.