HomeHome Product Discus... Product Discus...RazorCartRazorCartAdding DNN role logic in viewsetsAdding DNN role logic in viewsets
Previous
 
Next
New Post
4/12/2017 9:42 AM
 
In my viewset how can I add logic for user roles, if user is in a certain role then show button.

The object @Model does not contain any user/portal info since the DNN adds it already in @Dnn, please see the following code for solution:
 
@if (Dnn.User.IsInRole(Dnn.PortalSettings.AdministratorRoleName))
{
    <span>@(Dnn.PortalSettings.AdministratorRoleName)</span>
}

At your service,
Dave Smith
DotNetNuke Consulting, DotNetNuke Store and DNN Ecommerce
 
Previous
 
Next
HomeHome Product Discus... Product Discus...RazorCartRazorCartAdding DNN role logic in viewsetsAdding DNN role logic in viewsets