public static Authorize ( this menu, IAction action ) : void | ||
menu | this | |
action | IAction | |
Результат | void |
public static void Authorize(this MenuObject menu, IAction action)
{
foreach (var sub in menu.SubMenus)
{
sub.Authorize(action);
}
// Menu is enabled if one of it submenu's is, or if a task is associated with either an empty Subject or one that is allowed.
menu.Enabled = (menu.SubMenus.Any(m => m.Enabled)
|| (menu.Task != null && (menu.Task.Subject == null || AuthorizationManager.IsAllowed(menu.Task.Subject.Name, action))));
}