Showing posts with label Master page. Show all posts
Showing posts with label Master page. Show all posts

Friday 28 April 2017

Switch Master Page Minimum Permissions

Problem: Use the Client Side Object Model (CSOM C#) to add a new master pages to a site collection and switch the master page.

Initial Hypothesis: Writing to a site collection only required contribute rights or even "designer" rights at the web application permission level.

Resolution: The minimum permission set for changing master pages is "Full Permission" which a site owner and the site collection admin have.  So to switch master pages you need a high set of permissions.  UI allows master pages to be switched when the user only has "Design" permissions. This proof is flawed as the UI and CSOM permissions are different.  Can the UI have different permissions to the CSOM API???  Am I going mad.  
SPWeb object with Design user permissions cannot be updated and the API returns an "Access Denied Error" - Thanks to Sachin Khade for identifying this.

Updated 26/05/2017:  So the reply I got from the engineer who raised a Microsoft ticket is "SharePoint designer and  SharePoint GUI only need to have design permission to change the master page. This is because SharePoint designer is created as an extension of the SharePoint product. However, since CSOM calls are coded using Visual studio, the code flow involved in this is different and hence requires permissions that are higher than what SPD needs."

Summary: "Design" rights allow the user to change the master page using the UI however the same user cannot switch the master page using the CSOM C# approach.

Updated 26/05/2017: Thanks to Aswin Bhaskaran for working out a minimum permission set for using CSOM to switch the master pages on a site collection:
Note: "Design" rights can be applied at the Web Application Policy level allowing the accounts with "Design" rights the ability to add master pages.  The "Design" permission is only built into SP at the Site Collection level, I created the "Design" permission with the same permissions at the web application level to ensure my account in the Web app Design group has access to all site collections on my web app.

Note: Microsoft do not recommend customized master pages for O365 or future development.  Rather inject JavaScript to modify pages.

Tuesday 7 December 2010

Amending the Welcome Menu

Problem: Welcome Menu or Personal Actions Menu occasionaly refered to as the User Menu. SharePoint 2010 that displays the users name in the Welcome server control, this by default in the top right of the master page.  You can add new menu items or hide existing menu items.
Initial Hypothesis
  • The Welcome user control is located in the 14 hive at 14\TEMPLATE\CONTROLTEMPLATES

  • The user control is reference in master pages.
  • Take a copy of the welcome.ascx file as you will be working on the original or need to reference your new copy in your master page.
Resolution: Hide the menu option in the Welcome Menu.
Use the PermissionString property to dispay the menu option depending on your permissions.
Edit the Welcome.ascx file for each menu option element add the visible attribute and set it to false to hide the menus.
List of valid properties for the PermissionsString property
Alternatively set the MenuItemTemplate attrivute visibility to false, this will hide the menu option for everyone.
 
Resolution - Another option for changing the welcome control:
  • Remove the server control wssuc:Welcome from the master page or set it's visibility to hidden.
  • Then write a Replacement control and add it to the master page.

 Resolution:  Add a new menu item
  • Add a new element to the project that will be deployed as a feature

  • Add the following code to the element file

 

  •  New menu item (Open BBC) is add to the welcome menu.

 

More Info:
http://glorix.blogspot.com/2007/08/custom-action-locations-and-groupid.html
http://www.sharepointnutsandbolts.com/2007/07/using-customaction-to-modify-system.html
http://blog.thekid.me.uk/archive/2007/06/23/sample-editcontrolblock-customaction-for-sharepoint.aspx

How to Hide Ribbon
http://blogs.msdn.com/b/zwsong/archive/2010/04/29/how-to-hide-ribbon-from-users-without-edit-page-privilege.aspx

Chris O'Briens Ribbon Customisation blog series
http://www.sharepointnutsandbolts.com/2010/01/customizing-ribbon-part-1-creating-tabs.html