This project is read-only.

User Permissions and Roles

Topics: Writing modules
Jul 11, 2011 at 4:33 PM

Hi there..

I want to hide/show an Edit button in my view(module) based on role of a user. I want to make this happen using permissions. How  would I define a permission for hiding/showing the Edit button in Orchard for my module?

Thank you..

Jul 11, 2011 at 7:44 PM

You can look at any permissions.cs file from the built-in modules, and then look for places where those permissions are being used.

Jul 11, 2011 at 7:48 PM

Thank you for the response, that's exactly what I did.

Jul 11, 2011 at 7:50 PM

Any success or do you still need help with this?

Jul 11, 2011 at 9:43 PM

I was able to hide/show the button by creating a permissions.cs file in my module. Thank you :)

Sep 13, 2011 at 1:16 PM

how I can list all roles, not for current user but all existing roles, in cshtml? I know there is a function named getRoles() in IRoleService but how to use it in cshtml?
Thanks for any help.