I'm trying to make the Ribbon such that only authorized admin (permissions set in the site permissions feature) can use the Ribbon controls (Browse, Edit, Page). How do I prevent unauthorized users from using the ribbon? I'm currently using SharePoint 2013. Is the solution to this issue under site settings? Or maybe I have to use javascript? Please help me thanks.
2 Answers
You could use SPSecurityTrimmedControl for this.
<!—MS:<SharePoint:SpSecurityTrimmedControl runat="server" permission="permission needed to access">—>
the content you want to hide
<!—MS:</SharePoint:SpSecurityTrimmedControl>—>
Some sample threads for your reference.
-
This solution works to a certain extent. It does disable the ribbon but causes my UI's scrollbar to be gone, and I can't scroll down the page. Is there any alternatives to display:block? I tried display:none it doesn't work either.– DeniseDec 20, 2017 at 8:02
-
Is the solution to this issue under site settings?
Unfortunately, No.
Or maybe I have to use javascript?
No need to use JS, just follow the below steps to hide the ribbon from the non-admin users
Steps
- Open SharePoint Designer.
- Open your site > From left side Click on Master Pages.
- In SharePoint 2013 There are two related files for Master Page (HTML, Master)
Right Click on your custom Master Page with HTML extension > Check Out.
Again, Right Click on Master Page with HTML extension > Edit File Advanced Mode.
Search for DIV with ID
“ms-designer-ribbon“
Surround it with this tag
SharePoint:SPSecurityTrimmedControl
to looks the following
<!--MS:<SharePoint:SPSecurityTrimmedControl runat="server" PermissionsString="FullMask">--> < div id="ms-designer-ribbon" > <!--SID:02 {شريط}--> <!--PS: --> <!--PE: --> </div> <!--ME:</SharePoint:SPSecurityTrimmedControl>-->
- In PermissionsString attribute, you can add any permission type based on your requirement from the following:
- FullMask.
- EmptyMask.
- ManagePermissions.
- ManageSubwebs.
- ManageWeb.
- AddAndCustomizePages.
- BrowseDirectories.
- ViewPages.
- EnumeratePermissions.
- ManageAlerts.
- Save the changes > Check In > Publish Master Page as a major version.
Check the detail steps at How to hide the SharePoint 2013 ribbon
-
Comments are not for extended discussion; this conversation has been moved to chat. Dec 20, 2017 at 8:56