X
Closing this message and/or accessing our website tells us you are happy to receive all cookies on the ClearPeople website.
However, if you would like to, you can change your cookies settings at any time.
Recently, I had a problem when I wanted to create a page that had a script editor web part embedded ​in the layout (custom page layout).

When I was logged in as an owner user, I could create this kind of page without any problem. However, when I was logged in as a member user, I could create the page and check in the page but, I couldn’t publish the page or edit it again after that. When I tried to publish or edit after checking in I was getting this error:


sharepoint script


Besides, if I used again the owner user to edit the page, this time I could edit the page without error but, I noticed that the code snippet of the script editor web part was blank (the code disappeared).


After some research, I also noticed that when using a member user, I couldn’t add a search web part to any page (the set of search web parts is not available when editing a page) and I concluded that this was being caused due to a problem with the permissions of the built-in members group.


In order to avoid this behavior, you need to add a set of new permissions to the group that you want to be able to create this kind of custom pages.


To do this manually, follow these steps:

  • Log in as the site collection administrator
  • Go to “Site settings” and click on “Site permissions”
  • Click on “Permission Levels”:

Sharepoint script2

 

  • Click on “Add a Permission Level” to create a new set of permissions:

sharepoint script3

 

  • Give the new permission level a name, mark the “Add and Customize Pages” checkbox under the “Site Permissions” section (when clicking on the box, several permissions will be checked automatically) and click the “Create” button at the bottom of the page:

sharepoint script4

  • Go back to “Site permissions”, select the group that you want to have this new set of permissions and click on “Edit User Permissions”:

sharepoint script5


 

  • Check the box of the new set of permissions you’ve just created and click “OK”:

sharepoint script6



After following these steps, the users in that group will be able to create and publish custom pages with script editor web parts embedded in the layout and also to add search web parts to pages.


On the other hand, if you are using PnP in your development, you could perform all of these steps in one only xml template. In order to create this new permission level and assign it to the built-in members group of your site collection, you could use this xml template:

<?xml version="1.0" encoding="utf-8" ?>
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2016/05/ProvisioningSchema">
<pnp:Preferences/>
<pnp:Templates>
<pnp:ProvisioningTemplate ID="Root.Security">
<pnp:Security ClearSubscopes="false">
<pnp:Permissions>
<pnp:RoleDefinitions>
<pnp:RoleDefinition Name="Deploy Web Parts" Description="Can edit pages and add Search and Editor Web Parts.">
<pnp:Permissions>
<pnp:Permission>EmptyMask</pnp:Permission>
<pnp:Permission>ViewListItems</pnp:Permission>
<pnp:Permission>Open</pnp:Permission>
<pnp:Permission>ViewPages</pnp:Permission>
<pnp:Permission>AddAndCustomizePages</pnp:Permission>
<pnp:Permission>BrowseDirectories</pnp:Permission>
</pnp:Permissions>
</pnp:RoleDefinition>
</pnp:RoleDefinitions>
<pnp:RoleAssignments>
<pnp:RoleAssignment Principal="{associatedmembergroup}" RoleDefinition="Deploy Web Parts" />
</pnp:RoleAssignments>
</pnp:Permissions>
</pnp:Security>
</pnp:ProvisioningTemplate>
</pnp:Templates>
</pnp:Provisioning>


After applying this provisioning template, you would get the same results as following the steps listed above.

Author bio

Ivan Chesa
Ivan Chesa
Junior Developer
I’m part of the SharePoint development team. Besides working on client and internal projects, I enjoy learning more about other technologies like Azure. In my spare time I love playing video games with friends and I also like to watch TV shows.

Comments


comments powered by Disqus

Related Articles

Sign up to our Newsletter

Every now and then, we'd like to send you information that delivers, develops and promotes our products and services that are relevant to you. Submitting your details tells us that you're OK with this and you also agree to our Privacy & Cookies policy. You can, of course, opt out of these communications at any time.