Security Trimming

The Kendo UI Menu widget has a built-in security trimming functionality which is enabled by default.

If the URL to which the Menu item points is not authorized, then the Menu item is hidden. Security trimming depends on the ASP.NET MVC Authorization. Every action method which is decorated with the AuthorizeAttribute checks whether the user is authorized and allows or forbids the request. For more information, refer to the documentation on ASP.NET MVC Authorization.

The Menu hides the Menu item if the OnAuthorization method returns HttpUnauthorizedResult.

To use a custom AuthorizeAttribute, refer to the demo on implementing custom authorization.

When the Menu items are removed because of lacking permissions, a parent item may be left without any children. The following example demonstrates how to use the Menu option for removing the "orphaned" parent items.

@(Html.Kendo().Menu()
    .Name("MainMenu")
    .SecurityTrimming(s => s.HideParent(true))
)

See Also

In this article
Not finding the help you need? Improve this article