Sunday, April 22, 2012

Dynamics CRM 2011 : Restrict/Hide Settings Sitemap Area by Security Role

In Dynamics CRM 2011 we can restrict the entity privileges to none for hiding the Sitemap SubArea navigation item but there is no security role privilege available for hiding some of Settings area SubArea items i.e. System Jobs, Administration, Business Administration etc...

To hide the Settings area from the sitemap via security role, we have to restrict all SubArea navigation items privileges to none and required to add the privilege node to the SubArea items which do not have any security privileges mentioned in Security Role setup.

[Solution Steps]

The following steps below describe the solution for hiding the Sitemap area.

1.    Export SiteMap solution, go to Settings Customization Solutions and click on new button. Enter solution detials and add the SiteMap item and export the unmagaed solution

2.    Create new custom entity with name Priv : Site Map Settings (logical Name: wod_privsitemapsettings)

3.    Unzip solution file and open customizations.xml file into visual studio, notepad or Xml editor

4.    Search for Setttings area node <Area Id="Settings" ResourceId="Area_Settings"

5.    Add the following privlege node into all of SubArea items which does not have privlege node

<Privilege Entity="wod_privsitemapsettings" Privilege="Read "/>

6.     Save file, zip all files and import the solution into the system

7.    Publish all customizations and in User Secruity role change the entity Priv : Site Map Settings privleges to none
[Sample SiteMap Settings Area XML Code]

<Area Id="Settings" ResourceId="Area_Settings" ShowGroups="true" Icon="/_imgs/settings_24x24.gif"
        <Group Id="Business_Setting" ResourceId="Menu_Label_Business"

                <SubArea Id="nav_businessmanagement" ResourceId="Homepage_BusinessManagement"
                 Icon="/_imgs/ico_18_busmanagement.gif" Url="/tools/business/business.aspx"
                 AvailableOffline="false" >
                        <!—Custom Privilege Node.... -->
                        <Privilege Entity="wod_privsitemapsettings" Privilege="Read "/>

                <SubArea Id="nav_template" ResourceId="Homepage_Template"                                      
                 DescriptionResourceId="Template_SubArea_Description" Icon="/_imgs/ico_18_templates.gif"
                 Url="/tools/templates/templates.aspx" AvailableOffline="false" >
                        <!—Custom Privilege Node.... -->
                        <Privilege Entity="wod_privsitemapsettings" Privilege="Read "/>

                <SubArea Id="nav_productcatalog" ResourceId="Homepage_ProductCatalog"
                 Icon="/_imgs/ico_18_productcatalog.gif" Url="/tools/productcatalog/productcatalog.aspx"                       
                        <!—System Defined Privilege Node.... -->
                        <Privilege Entity="product" Privilege="Read" />
        <!--Other Groups.... -->