Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helper method for filtering the sitemap for the current user #1262

Closed
tidyui opened this issue Jul 2, 2020 · 0 comments
Closed

Add helper method for filtering the sitemap for the current user #1262

tidyui opened this issue Jul 2, 2020 · 0 comments
Assignees
Milestone

Comments

@tidyui
Copy link
Member

tidyui commented Jul 2, 2020

This method should filter the given collection SitemapItem objects and only return the ones the current user has access to. This is to simplify menu rendering in applications with secured pages.

Example

@inject Microsoft.AspNetCore.Authorization.IAuthorizationService Auth

<ul>
   @foreach (var item in await WebApp.Site.Sitemap.ForUserAsync(User, Auth))
   {
      <li><a href="@item.Permalink">@item.MenuTitle</a></li>
   }
</ul>

This also includes adding the Permission collection to the SitemapItem which is currently missing.

@tidyui tidyui added this to the Version 8.4 milestone Jul 2, 2020
@tidyui tidyui self-assigned this Jul 2, 2020
@tidyui tidyui closed this as completed in 83a84f8 Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant