0

We are creating a back end admin system and want to allow users in roles such as finance and membership to have access to certain areas. Ideally we would like to show only areas that you have access to in the navigation.

Using umbraco 4.7+ and razor. We are using the Microsoft role provider.

I was wondering if anyone knows how I could access the currently logged in users role?

4

1 回答 1

4

DynamicNode两种方法可以成为您的朋友,HasAccess()并且IsProtected(). 这是一个如何过滤和显示用户只能访问的节点的示例。这是另一个

使用这些方法,您不需要获取当前登录用户的角色,但这也不难做到。Roles.GetRolesForUser()返回当前登录用户角色的数组。有关详细信息,请参阅文档

于 2012-08-07T17:52:01.827 回答