﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>David&#039;s technobabble &#187; conditional</title>
	<atom:link href="http://bable.cybermarshall.com/tag/conditional/feed/" rel="self" type="application/rss+xml" />
	<link>http://bable.cybermarshall.com</link>
	<description>David&#039;s thoughts about this and that</description>
	<lastBuildDate>Fri, 22 Jan 2010 18:29:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Customizing and enhancing the security of a WSS 3.0/SharePoint 2007 site</title>
		<link>http://bable.cybermarshall.com/2009/01/08/customizing-and-enhancing-the-security-of-a-wss-30sharepoint-2007-site/</link>
		<comments>http://bable.cybermarshall.com/2009/01/08/customizing-and-enhancing-the-security-of-a-wss-30sharepoint-2007-site/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 04:00:14 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[conditional]]></category>
		<category><![CDATA[rendering]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[WSS 3.0]]></category>

		<guid isPermaLink="false">http://bable.cybermarshall.com/?p=272</guid>
		<description><![CDATA[ [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to compare the capabilities of WSS 3.0 (Sharepoint 2007) to host forum-like discussions, blogs and wiki&#8217;s. After I&#8217;d developed my site, there were items that were visible to anonymous and standard users that I felt were inappropriate. I wanted information to be visible or not based upon the users role. Such as the ability to view lists of People and Groups.  I&#8217;ve worked in several businesses where exposing customer names to all users is a violation of customer agreements. IMHO, this is a serious oversight in Microsoft&#8217;s implementation.<br />
<span id="more-272"></span><br />
After I did a good bit of research, experimentation and learning I was able to change the security using the SPSecurityTrimmedControl. Here is how I restricted access to some portions on my Sharepoint Site.</p>
<p>WSS 3.0 provides a control <a href="#spstrim">SPSecurityTrimmedControl</a> that allows the conditional rendering of content based on a users permission. Using this control, I was able to restrict who would be shown People and Groups on my site.  To do this I modified the <a href="#people">people.aspx</a> and the <a href="#groups">groups.aspx</a> files for my site.</p>
<p><em>A word of caution: I have no doubt that when applying a future service pack, Microsoft will overwrite my changes. Therefore I&#8217;m managing my changes externally from the Microsoft SharePoint directory. This will allow me to difference new code from Microsoft and reapply my changes.</em></p>
<p><a id="people" name="people"></a><br />
<strong>people.aspx</strong><br />
The file people.aspx resides in the <span style="text-decoration: underline;"><em>\Program Files\Common Files\Microsoft Shared\web server  extensions\12\TEMPLATE\LAYOUTS</em></span> folder. It lists the persons in the site. After I made a backup copy, I opened the file in a text editor and located the start of the &#8220;PlaceHolderMain&#8221; asp:Content section and added the start of my permission change</p>
<p>before</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;asp:Content</span> <span class="re0">contentplaceholderid</span>=<span class="st0">&quot;PlaceHolderMain&quot;</span> <span class="re0">runat</span>=<span class="st0">&quot;server&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;asp:PlaceHolder</span> <span class="re0">id</span>=<span class="st0">&quot;PanelAllPeople&quot;</span> <span class="re0">runat</span>=<span class="st0">&quot;server&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc3"><span class="re1">&lt;div</span> <span class="re0">class</span>=<span class="st0">&quot;ms-listdescription&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
</ol>
</div>
<p>after</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;asp:Content</span> <span class="re0">contentplaceholderid</span>=<span class="st0">&quot;PlaceHolderMain&quot;</span> <span class="re0">runat</span>=<span class="st0">&quot;server&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;SharePoint:SPSecurityTrimmedControl</span> <span class="re0">runat</span>=<span class="st0">&quot;server&quot;</span> <span class="re0">PermissionsString</span>=<span class="st0">&quot;ManagePermissions&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;asp:PlaceHolder</span> <span class="re0">id</span>=<span class="st0">&quot;PanelAllPeople&quot;</span> <span class="re0">runat</span>=<span class="st0">&quot;server&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc3"><span class="re1">&lt;div</span> <span class="re0">class</span>=<span class="st0">&quot;ms-listdescription&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>I located the end of the &#8220;PlaceHolderMain&#8221; asp:Content section and completed my permission change.</p>
<p>before</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;asp:HyperLink</span> <span class="re0">id</span>=<span class="st0">&quot;LnkCallTo&quot;</span> <span class="re0">runat</span>=<span class="st0">&quot;server&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">Text</span>=<span class="st0">&quot;&lt;%$SPHtmlEncodedResources:wss,people_callbuttontext%&gt;</span>&quot;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; style=&quot;visibility:hidden;display:none&quot;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NavigateUrl=&quot;callto:&quot; /&gt;</div>
</li>
<li class="li1">
<div class="de1"><span class="sc3">&lt;/asp:Content&gt;</span></div>
</li>
<li class="li1">
<div class="de1"></span></div>
</li>
</ol>
</div>
<p>after</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;asp:HyperLink</span> <span class="re0">id</span>=<span class="st0">&quot;LnkCallTo&quot;</span> <span class="re0">runat</span>=<span class="st0">&quot;server&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">Text</span>=<span class="st0">&quot;&lt;%$SPHtmlEncodedResources:wss,people_callbuttontext%&gt;</span>&quot;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; style=&quot;visibility:hidden;display:none&quot;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NavigateUrl=&quot;callto:&quot; /&gt;</div>
</li>
<li class="li1">
<div class="de1"><span class="sc3">&lt;/SharePoint:SPSecurityTrimmedControl&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3">&lt;/asp:Content&gt;</span></div>
</li>
<li class="li1">
<div class="de1"></span></div>
</li>
</ol>
</div>
<p>I also located the modifed the &#8220;PlaceHolderLeftNavBar&#8221; asp:Content and made the similar changes as above to require the user to have ManagePermissions as well.</p>
<p><a id="groups" name="groups"></a><br />
<strong>groups.aspx</strong><br />
The file group.aspx resides in the<span style="text-decoration: underline;"><em> \Program Files\Common Files\Microsoft Shared\web server  extensions\12\TEMPLATE\LAYOUTS</em></span> folder. It lists the groups in the site.  After I made a backup copy, I opened the file in a text editor and made the same &#8220;PlaceHolderMain&#8221; asp:Content section changes as I had to <a href="#people">people.aspx</a>.</p>
<p><a id="spstrim" name="spstrim"></a><br />
<strong>Overview of SPSecurityTrimmedControl</strong></p>
<p>The SPSecurityTrimmedControl conditionally renders the included contents only when the current user has the permissions defined by the PemissionsString.<br />
An example requiring the user to have &#8220;ManagePermissions&#8221;:</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;Sharepoint:SPSecurityTrimmedControl</span> <span class="re0">runat</span>=<span class="st0">&quot;server&quot;</span> <span class="re0">PermissionsString</span>=<span class="st0">&quot;ManagePermissions&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="coMULTI">&lt;!&#8211;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&#8230;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="coMULTI">&#8230; code being managed &#8230;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&#8230;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&#8211;&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;/SharePoint:SPSecurityTrimmedControl<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>Here are some of the values for the PermissionsString</p>
<table border="0">
<tbody>
<tr>
<td><em><strong>Permissions String</strong></em></td>
<td><em><strong>Description</strong></em></td>
</tr>
<tr>
<td>AddAndCustomizePages</td>
<td>Add, change, or delete HTML pages or Web Part Pages, and edit the Web site using a Windows SharePoint Services–compatible editor.</td>
</tr>
<tr>
<td>AddDelPrivateWebParts</td>
<td>Add or remove personal Web Parts on a Web Part Page.</td>
</tr>
<tr>
<td>AddListItems</td>
<td>Add items to lists, add documents to document libraries, and add Web discussion comments.</td>
</tr>
<tr>
<td>ApproveItems</td>
<td>Approve a minor version of a list item or document.</td>
</tr>
<tr>
<td>BrowseDirectories</td>
<td>Enumerate files and folders in a Web site using Microsoft Office SharePoint Designer 2007 and WebDAV interfaces.</td>
</tr>
<tr>
<td>BrowseUserInfo</td>
<td>View information about users of the Web site.</td>
</tr>
<tr>
<td>CancelCheckout</td>
<td>Discard or check in a document which is checked out to another user.</td>
</tr>
<tr>
<td>CreateAlerts</td>
<td>Create e-mail alerts.</td>
</tr>
<tr>
<td>CreateGroups</td>
<td>Create a group of users that can be used anywhere within the site collection.</td>
</tr>
<tr>
<td>DeleteListItems</td>
<td>Delete items from a list, documents from a document library, and Web discussion comments in documents.</td>
</tr>
<tr>
<td>DeleteVersions</td>
<td>Delete past versions of a list item or document.</td>
</tr>
<tr>
<td>EditListItems</td>
<td>Edit items in lists, edit documents in document libraries, edit Web discussion comments in documents, and customize Web Part Pages in document libraries.</td>
</tr>
<tr>
<td>EditMyUserInfo</td>
<td>Allows a user to change his or her user information, such as adding a picture.</td>
</tr>
<tr>
<td>EnumeratePermissions</td>
<td>Enumerate permissions on the Web site, list, folder, document, or list item.</td>
</tr>
<tr>
<td>ManageAlerts</td>
<td>Manage alerts for all users of the Web site.</td>
</tr>
<tr>
<td>ManageLists</td>
<td>Create and delete lists, add or remove columns in a list, and add or remove public views of a list.</td>
</tr>
<tr>
<td>ManagePermissions</td>
<td>Create and change permission levels on the Web site and assign permissions to users and groups.</td>
</tr>
<tr>
<td>ManagePersonalViews</td>
<td>Create, change, and delete personal views of lists.</td>
</tr>
<tr>
<td>Open</td>
<td>Allow users to open a Web site, list, or folder to access items inside that container.</td>
</tr>
<tr>
<td>OpenItems</td>
<td>View the source of documents with server-side file handlers.</td>
</tr>
<tr>
<td>UpdatePersonalWebParts</td>
<td>Update Web Parts to display personalized information.</td>
</tr>
<tr>
<td>ViewFormPages</td>
<td>View forms, views, and application pages, and enumerate lists.</td>
</tr>
<tr>
<td>ViewListItems</td>
<td>View items in lists, documents in document libraries, and view Web discussion comments.</td>
</tr>
<tr>
<td>ViewPages</td>
<td>View pages in a Web site.</td>
</tr>
<tr>
<td>ViewUsageData</td>
<td>View reports on Web site usage.</td>
</tr>
<tr>
<td>ViewVersions</td>
<td>View past versions of a list item or document.</td>
</tr>
</tbody>
</table>
<p>The full list is on <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx">msdn</a>.</p>
<p><center><script type="text/javascript"><!--
google_ad_client = "pub-5633552336244805";
google_ad_slot = "5649858591";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</center></p>
]]></content:encoded>
			<wfw:commentRss>http://bable.cybermarshall.com/2009/01/08/customizing-and-enhancing-the-security-of-a-wss-30sharepoint-2007-site/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

