This question is locked. New answers and comments are not allowed.
I'm having the same issue as Ben was in this post: http://www.telerik.com/community/forums/aspnet-mvc/general/the-menu-control-and-authorizecore.aspx#1717973
The only difference is that I'm not using a sitemap to build the menu - instead the menu is hardcoded into the layout.
I'm seeing the same behavior where if one of the actions in the menu has my CustomAuthorizeAttribute, AuthorizeCore is never being called. The menu option is simply hidden.
Here is the code I'm using for the menu:
@{
var navAuthorization = Telerik.Web.Mvc.Infrastructure.DI.Current.Resolve<Telerik.Web.Mvc.Infrastructure.INavigationItemAuthorization>();
Html.Telerik()
.Menu()
.Name("Menu")
.Items(menu =>
{
menu.Add().Text("Home").Url("~/");
menu.Add().Text("External System Connections").Action("Listing", "ExternalSystem");
menu.Add().Text("Agencies").Action("Listing", "Agency");
menu.Add().Text("Users").Action("Search", "User");
menu.Add().Text("Devices").Action("Search", "Device");
menu.Add().Text("Chat").Action("Listing", "DistributionList");
menu.Add().Text("Configuration").Action("Listing", "Configuration");
menu.Add().Text("Annunciator").Action("Listing", "Annunciator");
menu.Add().Text("Log out").Action("LogOut", "Home");
})
// Hide top level menus if none of the sub menus are accessible
.ItemAction(item =>
{
bool hasAccessible = true;
foreach (var children in item.Items)
{
hasAccessible = false;
if (children.IsAccessible(navAuthorization, ViewContext))
{
hasAccessible = true;
break;
}
}
item.Visible = hasAccessible;
})
.Render();
}
I'm using the latest version of the controls (7/12/2011)
The only difference is that I'm not using a sitemap to build the menu - instead the menu is hardcoded into the layout.
I'm seeing the same behavior where if one of the actions in the menu has my CustomAuthorizeAttribute, AuthorizeCore is never being called. The menu option is simply hidden.
Here is the code I'm using for the menu:
@{
var navAuthorization = Telerik.Web.Mvc.Infrastructure.DI.Current.Resolve<Telerik.Web.Mvc.Infrastructure.INavigationItemAuthorization>();
Html.Telerik()
.Menu()
.Name("Menu")
.Items(menu =>
{
menu.Add().Text("Home").Url("~/");
menu.Add().Text("External System Connections").Action("Listing", "ExternalSystem");
menu.Add().Text("Agencies").Action("Listing", "Agency");
menu.Add().Text("Users").Action("Search", "User");
menu.Add().Text("Devices").Action("Search", "Device");
menu.Add().Text("Chat").Action("Listing", "DistributionList");
menu.Add().Text("Configuration").Action("Listing", "Configuration");
menu.Add().Text("Annunciator").Action("Listing", "Annunciator");
menu.Add().Text("Log out").Action("LogOut", "Home");
})
// Hide top level menus if none of the sub menus are accessible
.ItemAction(item =>
{
bool hasAccessible = true;
foreach (var children in item.Items)
{
hasAccessible = false;
if (children.IsAccessible(navAuthorization, ViewContext))
{
hasAccessible = true;
break;
}
}
item.Visible = hasAccessible;
})
.Render();
}
I'm using the latest version of the controls (7/12/2011)