We had been asked so many times how to remove “Site Actions” or “View All Site Content” for certain users.
So finally we found one simple trick which will work for our system.
Problem statement: remove “Site Actions” or “View All Site Content” for certain user.
Work Around: to remove View All Site Contents and Site Actions we need to modify master page.
For us we are using custom master page. To know how to set custom master page as default master page check this Link .please try not to modify default.master page use custom one.
Removing Site Actions:
Open your master page in any editor like Visual studio (recommended) or notepad.
If you opened it in Visual studio toggle the Site Action Control.
Check the screen shot.
Now add SharePoint:SPSecurityTrimmedControl control just before the SharePoint:SiteActions control
Check the screen shot.
Here is the text to add
<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="ManageSubwebs">
Now here is the description what we had done.
SPSecurityTrimmedControl as the name suggest, the control check the SharePoint permission and if user is permitted (if the user have permission) then it will access the content inside this control.
And if the user don’t have a permission then the content inside this control will not been accessed.
PermissionsString attribute define which set of permission can access the control.
You can give multiple permission by “,” (comma).
This “,” will work as OR condition to the permission set.
To check the permission set Enumeration check this link of MSDN
There is no other way to hide this buttons but we can do like this way.
Chose a permission from above msdn link like ManagePermissions or ManageWeb or DeleteVersions
the permission that your user don’t have.
And set it in master page.
Because our basic requirement is the END user should not see “Site Actions” and our END user must not have at least one permission from the permission list. Even contributor does not have all the permission.
So you are done by doing this you can remove site actions for non admin users without coding.
Removing View All Site Content:
Find “~site/_layouts/viewlsts.aspx” in the master page.
You will find Sharepoint:SPSecurityTrimmedControl is already there but the
PermissionsString attribute is set as “ViewFormPages”.
Which means that if a person have view rights in the form pages then that person can see this link.
You can also change PermissionsString to high permission like ManageSubwebs or ManagePermissions or something like that so that this link will also be removed if the login user don’t have permission mentioned in permissionstring.
Hope this will solve our basic problem which must have high priority for the clients.
Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to email@example.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!
If anyone would like to have their advertisement posted on this blog, please send us the requirement details to firstname.lastname@example.org