Visibility of Save and Publish buttton based on user roles

Topics: Customizing Orchard
Apr 13, 2012 at 5:07 PM

I have a blog on my Orchard site where I want to show the 'Save', 'Publish' and 'Publish Later' buttons depending upon the user role.

For e.g., if a user is in Writer role, then he should only be able to see Save button and not the other buttons.

If user is in Approver role, then he should see all the buttons.

Also, I want this functionality just for Blog posts and not all the other content types.

How do I approach this?

Thanks

Apr 15, 2012 at 11:53 AM

you can edit the role for Orchard.Blogs (Publish or unpublish blog post for others)

Apr 16, 2012 at 4:44 PM

Thanks for your response. It seems that editing the roles would Show the buttons, and when a user clicks on them it would display a message that they can't publish the post.

However, what I want is to hide the visibility of Save, Publish and Publish Later buttons depending on the user role.

Any idea how can that be achieved?

Apr 17, 2012 at 6:32 AM

It seems the ContentsDriver will show the publish button disregard of the permission.

Maybe you can log an issue? For the moment, check out the ContentsDriver inside the Core module. You can add a check for the permission before adding the publish button shape.

Apr 17, 2012 at 9:53 PM

I resolved this issue by customizing the Orchard.Blogs module via Jquery.

I am hiding the buttons depending upon a user role on the client side via jquery and it serves my need for now.

Thanks for your inputs.