-
Notifications
You must be signed in to change notification settings - Fork 218
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
How to generate sitemap for not current user? #444
Comments
You can configure the roles on the
It is recommended to instead configure the roles on
|
Thank you for reply! Your link and issue #102 was very helpful! I found the way how to generate and show sitemap which contains only nodes accessible for users with roles, which I send to Html Helper.
<add key="MvcSiteMapProvider_SecurityTrimmingEnabled" value="false" />
<add key="MvcSiteMapProvider_DefaultSiteMapNodeVisibiltyProvider" value="MyCompanyName.Helpers.SiteMap.MyCustomVisibilityProvider, MyCompanyName" />
So that way I dynamically change sitemap menu on site. One problem that i dont know how to solve: Is there a way to turn on security trimming in runtime? All pages of my site have such helper for building menu: |
No. And I really don't understand why you would want to, since when you have security trimming enabled it automatically runs the code in the The way you have made your visibility provider is fine, but it basically means you are duplicating all of the code that is already in the Note that since you are reading the attribute instead of running the filter (which is what actually does the security check) that this approach won't work if you register bool isAuthenticated = HttpContext.Current.User.Identity.IsAuthenticated; If you need Security Trimming to work without actually removing nodes from the API, see #355 for an alternate way to plug in the |
Actually, there is a way to turn it on and off at runtime - see option 2 in this comment on #102. The "special administrative mode" is basically the same thing as toggling security trimming on and off. You would need to set security trimming to true globally, and then you could use this runtime setting to switch on and off the behavior in a wrapper |
Hi! I got a question.
I use MvcSiteMapProvider on my site and it works fine! But i cant find solution for the problem: my site have 1 sitemap, but users with different roles (Identity roles) see sitemap in different ways due to security trimming (it is ok). Admin wants to know, what nodes of sitemap is shown to concrete user (with roles A, B, C) or group of users with same roles. Is there any way to render sitemap using only list of roles?
The text was updated successfully, but these errors were encountered: