Displaying user's role

Topics: Customizing Orchard, General
May 19, 2011 at 4:39 PM

What would be the easiest way (if possible at all) of displaying what role a user is in?

With layers, I know I can make the layer conditional on if the user is Authenticated, but can I have a layer rule based upon any other role?

May 19, 2011 at 6:16 PM

On the Gallery, there's a module that gives you a role-based layer.

May 19, 2011 at 6:44 PM
randompete wrote:

On the Gallery, there's a module that gives you a role-based layer.


I saw that, have you got it to work for you? I haven't.

May 20, 2011 at 2:28 AM

I poured through the source code and discovered how the module Role Layer Rule - Version: 1.0 works.

It is quite simple really and similar to how the URL filter works ( See "Managing Widgets" (http://orchardproject.net/docs/Managing-widgets.ashx) )

Suppose you had a role MyFriends, and you wanted a Layer that was active for MyFriends on the homepage only. You would write the rule as:

role("MyFriends") and url("~/")

Hopefully this will help someone else who wants to use this module.