Security Trimming in multi-level menus

1 Answer 50 Views
Menu
David
Top achievements
Rank 1
Iron
Veteran
Iron
David asked on 28 Jun 2023, 07:09 PM

Am I missing a configuration option?  I have a menu which has several levels of menus.  With "Security Trimming" enabled, root level objects get trimmed with no issues.  Parents which have their children objects "trimmed", still show up.  Example:

 


@(Html.Kendo().Menu()
                          .Name("Menu")
                          .SecurityTrimming(true)
                          .Items(items =>
                          {
                                items.Add().Text("Home").Action("Index", "Home");
                                items.Add().Text("Owners").Action("Index", "Owners");
                                items.Add().Text("Interred").Action("Index", "Interred");
                                items.Add().Text("Maintenance").Items(itm =>
                                {
                                    itm.Add().Text(@"Sections/Lots/Spaces").Action("Index", "MaintainSpaces");
                                    itm.Add().Text("Search Tags").Action("Index", "MaintainSearchTags");
                                    itm.Add().Text("Undertakers").Action("Index", "MaintainUndertakers");
                                    itm.Add().Text("Reclaim Spaces").Action("Index", "MaintainReclaimSpaces");
                                    itm.Add().Text("Research Tool").Action("Index", "MaintainResearchTool");
                                    itm.Add().Text("Headstones").Action("Index", "MaintainHeadstones");
                                });
                                items.Add().Text("Reports").Items(itm =>
                                {
                                    itm.Add().Text("Available Spaces").Action("Index", "ReportsPage");
                                });
                        })
                )

As you can see the "Maintenance" and "Reports" menu items are still visible.  An example situation would be :

A unauthorized user sees the "Home" button, and everything else should be trimmed.  While the actual actions are getting trimmed, the "Maintenance" and "Reports" menu items (with nothing in them) are still there.

Am I missing a configuration option to also remove parents?

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 03 Jul 2023, 12:45 PM

Hello David,

There is an option to hide parents that have all of their children hidden:

.SecurityTrimming(st => st.HideParent(true))

Regards,
Ivan Danchev
Progress Telerik

As of R2 2023, the default icon type will be SVG instead of Font. See this blogpost for more information.

Tags
Menu
Asked by
David
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Ivan Danchev
Telerik team
Share this question
or