Security Trimming controls in Sharepoint 2010

In prior versions of Sharepoint hiding and displaying controls, especially the built in navigation/search/quick launch and toolbars was problematic to say the least.


Working on a new site this morning we had a requirement to hide the new Toolbar in 2010, along with the entire navigation bar to display a custom application page with just the web parts that they needed.


At first glance you could remove the snippets in the master page, but there's a few things that I didn't like.  The major one is that the functionality is lost on the ribbon and navigation.  I did some Binging and found a new tag that allows you to control the display of web parts/page markup based on Sharepoint permissions. 



<



 



 



SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" PermissionsString="ManagePermissions" runat="server">


<!-- Markup to display/hide based on permissions -->




</



 



 



SharePoint:SPSecurityTrimmedControl>


This snippet allows you to wrap any HTML/ASP markup and based on the PermissionsString either display or hide them.


Of course this works out really good in our project, if a user that has ManagePermissions goes to the page they see the regular ribbon and navigation, but if you do not it's all hidden.