Freigeben über


Regulate Branding, Master Pages and SharePoint Designer in SharePoint 2010

Let’s start off the article by saying that I am a very big proponent of Microsoft’s SharePoint Designer (SPD) product because it allows end users, administrators, designers and developers the opportunity to make changes that can directly impact productivity without the introduction of managed code. That being said, there are some issues that come with providing the freedom to do what is needed to maintain a SharePoint site, especially if someone else is on the hook if a person deletes a site, rebrands a page or causes other acts of madness with SPD.

One of the great features of Microsoft SharePoint Server (MSS) 2010 is that as a Farm Administrator I can check a couple of boxes and access to my farm’s site with SPD and other types of changes is DENIED! But let’s try to be a little more open-minded than taking the easy way out and just shutting everyone out of the fun.

Before we look at the code, let’s figure out what we want to do. The options are as follows:

  • Allow the use of SPD
  • Allow Master Page editing
  • Allow users to Revert from Template
  • Show URL Structure

The following lines of code can help you implement one measure of Governance, and some sense of sanity, within your SharePoint farm.

Code Snippet

  1. SPSite site = SPContext.Current.Site;
  2. // Check to see if the properties have been previously set by Admin and if so, retain those values
  3. // These properties change the settings in Site Collection Administration for the SharePoint Designer Settings
  4. site.AllowUnsafeUpdates = true;
  5. site.AllowDesigner = IsSiteDesignerAllowed(site);
  6. site.AllowMasterPageEditing = IsMasterPageEditingAllowed(site);
  7. site.AllowRevertFromTemplate = IsRevertFromTemplateAllowed(site);
  8. site.ShowURLStructure = ShowSiteURLStructure(site);
  9. site.Dispose();

 

The code above is reflected in the UI within SharePoint’s Central Administration:

 CA_Control_SharePoint_Designer_thumb_41CFA7D6

Let me try to explain what each option allows you to limit. First we have to the ability to limit SPD. In this case, we’re allowing the site administrators to edit sites with SPD. This is also scoped at the SPSite level, as well. deselecting this option will deny users to make changes via SPD.

Next is the “Detach Pages from Site Template”, which allows users to create their own design based off a template. It’s the equivalent of copying a template so it can be available in a stand-alone fashion.

“Allow Site Collection Administrators to Customize Master Pages and Layout Pages” enables changes to be made to those specific pages. This would significantly impact branding if you let users change the Master Page at will.

Finally, we have the ability to let users see (and manage) URL Structure. Moving pages, see which folders and files exist are just some of the examples.

So the purpose of showing the images is not for the code, but to show the potential flexibility that you have within your farm to allow some site collection administrators access to the tools needed, or restrict the use of those same tools to others.

As far as the code, a developer could continue with this and develop a feature where an administrator could turn on or turn off access on each Site Collection (SPSite) as needed. I like the fact that this solution is flexible and helps you govern your environment and the choices can be tuned on an as-needed basis