Posts

Showing posts with the label SPSecurityTrimmedControl

Security Trimmed Controls in SharePoint

Let’s say you have a control on your page that you want only a certain group of users to see. Fortunately, SharePoint has a built-in control that lets you hide controls to which users do not have the necessary permissions.  This control is the SPSecurityTrimmedControl. <Sharepoint:SPSecurityTrimmedControl runat=”server” Permissions=”ManageLists”> Place your control(s) here </SharePoint:SPSecurityTrimmedControl> All you have to do is wrap your control with this security control and set the correct permissions in the Permissions attribute. The Permissions attribute, when used in Visual Studio or Designer, will have intellisense and will be filled with the following properties obtained from http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx .  Whatever permissions you specify will be required by the user in order to view the control(s) inside of the SPSecurityTrimmedControl:   Member...

How To Hide Ribbon From Users Without Edit Page Privilege

 A way to remove or hide the ribbon area from user with lease privilege, and here is how: 1)       Open your SharePoint master page 2)       Locate this line: < div id ="s4-ribbonrow" class ="s4-pr s4-ribbonrowhidetitle"> 3)       Change it to: < div id ="s4-ribbonrow" class ="s4-pr s4-ribbonrowhidetitle" style =" display :none" > 4)       Now find the end of the “ s4-ribbonrow ” tag and add following block right after it: < Sharepoint : SPSecurityTrimmedControl ID ="SPSecurityTrimmedControl2" runat ="server" PermissionsString ="AddAndCustomizePages">     < script type ="text/javascript">         document.getElementById( "s4-ribbonrow" ).style.display = "block" ;     </ script > </ Sharepoint : SPSecurityTrimmedControl > 5)       Save the new master...