如何从 Razor html (Umbraco) 访问用户类型

How can I access user type from Razor html (Umbraco)

我使用 Umbraco,我需要为某些用户角色隐藏标签。 我如何知道视图中的用户角色?

用户 class 有一个内置函数 IsInRole(string roleName)。在你看来,你会这样写:

@if (User.IsInRole("myRole")){

    @html.editorfor....
}else{

    @html.hiddenfor...
}