Home > Blogs > Eric Shupps | The SharePoint Cowboy > Posts > SharePoint Global Navigation Sometimes Ignores Target Audience Settings
 
Eric Shupps eshupps The SharePoint Cowboy is the founder and President of BinaryWave, a leading provider of operational intelligence solutions for Microsoft SharePoint. Eric Shupps eshupps The SharePoint Cowboy has worked with SharePoint Products and Technologies since 2001 as a consultant, administrator, architect, developer and trainer. he is an advisory committee member of the Dallas/Ft. Worth SharePoint Community group and participating member of user groups throughout the United Kingdom. Eric Shupps eshupps The SharePoint Cowboy has authored numerous articles on SharePoint, speaks at user group meetings and conferences around the world, and publishes a popular SharePoint blog at http://www.sharepointcowboy.com. Presentations by Eric Shupps eshupps The SharePoint Cowboy Webinar - Migrating Legacy On Premise Solutions to SharePoint Online and Windows Azure featuring Eric Shupps Who are you and what do you want - Working with OAuth in SharePoint 2013 SharePoint is Talking Are You Listening? Eric Shupps SharePoint 2013 Performance Enhancements Taking Advantage of the SharePoint 2013 REST API Eric Shupps on Improving Performance with New Features in SharePoint 2013 SharePoint 2013 New and Improved Migrating Legacy On Premise Solutions to SharePoint Online and Windows Azure Eric Shupps Presents SharePoint 2013 Real World Help Desk App End to End Windows Azure Apps for SharePoint 2013 Eric Shupps Demonstrates Customizing the Visual Studio 2010 SharePoint Deployment Process Introduction to SharePoint Development SharePoint 2010 Unit and Integration Testing with Eric Shupps Building Enterprise Records Management Solutions for SharePoint 2010 Taming Information Chaos in SharePoint 2010 SharePoint 2010 Performance and Capacity Planning Best Practices Building Dynamic Applications with the SharePoint Client Object Model Articles by Eric Shupps eshupps The SharePoint Cowboy Eric Shupps' Ten Steps to Optimize SharePoint Performance Webcasts by Eric Shupps eshupps The SharePoint Cowboy Secrets of SharePoint Part 5: Configuring Microsoft Office SharePoint Server 2007 for Optimal Performance Creating End User SharePoint Solutions for Performance and Scalability SharePoint 2010 Performance Enhancements for Administrators by Eric Shupps Microsoft SharePoint Server 2010 for the ASP.NET Developer Eric Shupps on Following Best Practices and Avoiding Common Errors with Microsoft Office SharePoint Server 2007 Development Eric Shupps - SharePoint Performance and Capacity Planning Essentials Troubleshooting Common Performance Problems in SharePoint 2010 Videos by Eric Shupps eshupps The SharePoint Cowboy Channel 9 Interview with Eric Shupps SharePoint TechTalk with Eric Shupps - Different Views on Social Computing SharePoint Post-Deployment Planning and Management with Eric Shupps SmartTrack for SharePoint Feature Overview SmartTrack for SharePoint Podcasts by Eric Shupps eshupps The SharePoint Cowboy SharePoint Pod Show - Design for Performance (Eric Shupps) SharePoint Pod Show - Test Driven Development with Andrew Woodward and Eric Shupps eshupps The SharePoint Cowboy Run As Radio - Eric Shupps Improves SharePoint Performance
SmartTrack for SharePoint Eric Shupps Eric Alan Shupps eshupps @eshupps SharePoint Cowboy BinaryWave

 
​The SharePoint Cowboy


photo of  Eric Shupps
BinaryWave
611 S. Main St., Suite 400
Grapevine , TX , 76051 USA
Eric Shupps and Eric Alan Shupps with BinaryWave the BinaryWave Inc in BinaryWave Incorporated around SmartTrack beside SharePoint Monitoring through SharePoint alongside SharePoint Monitoring visiting @eshupps via eshupps near SharePoint performance and SharePoint management. The SharePoint cowboy eshupps BinaryWave and more on Operational Intelligence via Eric Alan Shupps SharePoint blog. SharePoint monitoring is a hot topic along with SharePoint Performance Measurement and SharePoint tips and tricks from Eric Shupps for SmartTrack. Another Eric Shupps on Technology and Eric Shupps on SharePoint with a new SharePoint Post from Eric Shupps. New BinaryWave post through BinaryWave Inc. and with another SharePoint blog we get to Eric Alan Shupps Blog about SharePoint development. That's Eric Shupps - BinaryWave or Eric Alan Shupps Fort Worth Grapevine Texas Dallas of BinaryWave talking about BinaryWave Operational Intelligence at the SharePoint Cowboy blog and on twitter as @eshupps. Of course SharePoint Administration is on topic for eshupps and another great post from Eric Shupps regarding BinaryWave SharePoint and SharePoint Maintenance.
October 26
SharePoint Global Navigation Sometimes Ignores Target Audience Settings

I recently came across a curious scenario when using target audiences with SharePoint 2010 global navigation. I began with a common enough requirement – create a static menu structure in which certain links would be visible only to members of specific SharePoint security groups (no Active Directory in this particular environment). The basic hierarchy looked something like the following:

Root Node [Members]
-- Publishing Page 1 [Custom SP Group 1]
-- Publishing Page 2 [Custom SP Group 1]
-- Layouts Page [Custom SP Group 2]
-- External Link [Custom SP Group 3]

In reality it was a bit more complex than that but not by much. At first, it all worked as expected. But then I noticed that the Layouts Page and External Link were showing up no matter what group a user was in. That seemed odd but not catastrophic – anonymous users still couldn't see the root node so all it needed was a little tweaking to get the groups right. That's where the fun began. The audience setting for each node mapped to only one SP group and there was no cross-membership in any of the groups. In theory, members of Group 3 shouldn't see anything but the last link; in practice, they were presented with the Layouts Page node and the External Link node but NOT the Publishing Page nodes. No matter what I did, the Layouts and External nodes always showed up.

About this time I realized that the Root node would have to changed as it wouldn't work for users on IOS (iPhone, iPad) – Safari on the touch platform won't allow the drop-down menu to expand like clicking on the arrow with a mouse would. It always navigates the user to the root node link. No problem, I had already dealt with this on the other root nodes, so I simply removed the link from the Root node, left the target audience set to Members, and inserted a child node (thus, when the root node was touched or clicked, it would simply expand the child nodes instead of navigating anywhere). The menu structure then became:

Root Node [Members] (empty link field)
-- Home Page [Members]
-- Publishing Page 1 [Custom SP Group 1]
-- Publishing Page 2 [Custom SP Group 1]
-- Layouts Page [Custom SP Group 2]
-- External Link [Custom SP Group 3]

Oops, now I really had a problem. As soon as I removed the hyperlink value from the root node, the root element, layouts node and external node all became visible to anonymous users! Mucho bad mojo, there – no way would the customer allow non-authenticated users to see a root node that should only be available to authenticated users. I put a random value into the hyperlink field to try and hide to root menu item but nothing worked until I put in a reference to an actual SharePoint object (web, page, list item, etc.) - so long as that object wasn't an application page in the /_layouts directory. Ok, serious head-scratching time. This didn't make any sense at all whatsoever. Why should SharePoint care whether or not the node links to an SP object or www.anyoldwebsite.com?

My immediate suspicion was that somehow the external and layouts links were falling through the security trimming logic in some way. However, Audiences don't work the same way as actual security groups. The only check that's performed on an audience is whether or not the user is a member of the specified group not whether that group actually has permissions on the target object – that's a completely different process. Had it been a security trimming issue, anonymous users wouldn't have been able to see the Layouts Page link as the lockdown feature was enabled on the site. Something else was going on behind the scenes but what could it be.

So, being the curious developer type that I am, I fired up ILSpy, turned on the Developer Dashboard and went to work tracking down this little gem of undocumented functionality. After stumbling along several blind alleys, following umpteen dead-end stub methods (really, do we need a bunch of classes that do nothing but return false every time they're called?), and twisting my brain around convoluted inline nested IF statements, I finally discovered the answer. Turns out that there's a nice little method in the Publishing namespace called CreateObjectFromID that is responsible for taking a reference to a cached node object in a site map data source and returning an object of a specific node type. Unfortunately, there are only three allowable node types – Web, Page or ListItem (with the default in the switch statement being ListItem). This means that a link must point to something that can be converted to one of these three types. Nice – not even a catch to allow for generic or non-SP objects.

As if that little coding blunder wasn't enough, the convoluted logic in the GetNavigationChildren method of PortalSiteMapNode allows a null object (which is the result of not matching one of the three allowable types) to be displayed – the exact opposite of how I would think it should work. This may not be security trimming but it's awfully darn close, at least in spirit – I would have fallen back to hiding anything I didn't know how to deal with (null) instead of allowing it to pass through. So, the net result is this brilliant bit of logic:

  1. If the node includes a link to something that cannot be converted to a Web, Page or ListItem, audience targeting will be ignored.
  2. If the root node does not satisfy #1 then the root and the child nodes will be hidden.
  3. If a child node satisfies #1 it will be displayed only IF the root node also satisfies #1.

The only way to circumvent this functionality is to make sure that all static links in the navigation settings point to valid SharePoint objects that are either a Web (site collection root or subsite), Page (publishing, web part, wiki, etc.) or a list item if you intend to use target audiences to restrict the display of individual nodes.

And there you have it. Another afternoon wasted in the dark back alleys of SharePoint. Aren't you glad I beat my head against the wall so you don't have to?

 

 

Comments

There are no comments for this post.

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Comment Date *

Select a date from the calendar.
Enter the current date to prevent automated spambot comments.

Spam Prevention *


How many letters, not including spaces, does it take to spell "SharePoint Cowboy"?

Attachments

 
photo of Eric Shupps Eric Alan Shupps eshupps @eshupps SharePoint Cowboy BinaryWave Eric Shupps
BinaryWave
611 S. Main St., Suite 400
Grapevine , TX , 76051 USA

 
 
 
Eric Shupps Eric Alan Shupps eshupps @eshupps SharePoint Cowboy BinaryWave 

Eric Shupps LinkedIn Eric Shupps Twitter Eric Shupps Facebook Eric Shupps Google+
 
 

 


 


BinaryWave Eric Shupps eshupps The SharePoint Cowboy SharePoint monitoring SharePoint monitoring tool SharePoint metrics SharePoint administratrion SharePoint monitoring best practices SharePoint management SharePoint management tool SharePoint operations SharePoint operationsmanagement SharePoint administration SharePoint administration tool SharePoint SLA SharePoint service level agreement SharePoint operational intelligence SharePoint performance SharePoint performance monitoring SharePoint analytics SharePoint real-time SharePoint intelligence SharePoint ITIL SharePoint service operations SharePoint uptime SharePoint alerts SharePoint health SharePoint tools SharePoint metrics SharePoint diagnostics SharePoint SmartTrack SmartTrack Operational Intelligence


Copyright © 2013 BinaryWave, Inc. All rights reserved.
This site is brought to you by BinaryWave in cooperation with Eric Shupps Eric Alan Shupps eshupps @eshupps The SharePoint Cowboy. We hope you enjoy the SharePoint-related content on topics such as performance, monitoring, administration, operations, support, business intelligence and more for SharePoint 2010, SharePoint 2013 and Office 365 created by Eric Shupps The SharePoint Cowboy. We also hope you will visit our product pages to learn more about SmartTrack, Operational Analytics for SharePoint, SharePoint monitoring, and SharePoint administration, while also discovering great offers from our partners. Please visit the blog of Eric Alan Shupps, Twitter handle @eshupps, for more information on application development, the SharePoint community, SharePoint performance, and general technology topics. Eric Shupps Eric Alan Shupps eshupps @eshupps The SharePoint Cowboy is the founder and President of BinaryWave, a leading provider of operational support solutions for SharePoint. Eric Shupps Eric Alan Shupps eshupps @eshupps The SharePoint Cowboy has worked with SharePoint Products and Technologies since 2001 as a consultant, administrator, architect, developer and trainer. He is an advisory committee member of the Dallas/Ft. Worth SharePoint Community group and participating member of user groups throughout the United Kingdom. Eric Shupps Eric Alan Shupps eshupps @eshupps The SharePoint Cowboy has authored numerous articles on SharePoint, speaks at user group meetings and conferences around the world, and publishes a popular SharePoint blog at http://www.binarywave.com/blogs/eshupps.