User Permissions and Roles

Topics: Writing modules
Jul 11, 2011 at 3: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 6: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 6:48 PM

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

Jul 11, 2011 at 6:50 PM

Any success or do you still need help with this?

Jul 11, 2011 at 8: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 12: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.