<?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>Dev Team Assemble &#187; Security</title>
	<atom:link href="http://www.calvinirwin.net/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.calvinirwin.net</link>
	<description>Evil beware!</description>
	<lastBuildDate>Wed, 28 Jul 2010 12:55:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SPException: SharePoint cannot find the user &#8211; SharePoint SPWeb.EnsureUser() and a Custom MembershipProvider</title>
		<link>http://www.calvinirwin.net/2009/08/05/sharepoint-spweb-ensureuser-and-thecustom-membership-provider/</link>
		<comments>http://www.calvinirwin.net/2009/08/05/sharepoint-spweb-ensureuser-and-thecustom-membership-provider/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 22:22:28 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[MembershipProvider]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=90</guid>
		<description><![CDATA[Its seems that SharePoint has a knack for surprising me with seriously strange errors sometimes.  Usually at the core of the error there is a sound explanation as to why this is happening but nonetheless I am not pleased with the obscurity of them sometimes.  Case in point, while working on a Console [...]]]></description>
			<content:encoded><![CDATA[<p>Its seems that SharePoint has a knack for surprising me with seriously strange errors sometimes.  Usually at the core of the error there is a sound explanation as to why this is happening but nonetheless I am not pleased with the obscurity of them sometimes.  Case in point, while working on a Console application that would load FBA (Forms Based Authentication) users into a sharepoint sie collection and then create a site for each one (granting permissions and so on) I came across a very strange error - <strong>SPException: SharePoint cannot find the user.</strong></p>
<p>This kind of surprised me at first and I was wondering if somehow my <strong>CustomMembershipProvider</strong> setup stopped working on my portal site, but that was fine. So after hammering away at it for a while I came across a <a href="http://blog.mastykarz.nl/inconvenient-programmatically-sharepoint-users-spweb-ensureuser/">great article written by Waldek Mastykarz</a> on this exact problem.  After reading through his investigation it makes sense why it doesn't work in a console application but it works under the context of a SharePoint website. Essentially the web application has access to a context object and this has access to the providers node in your web.config file,  BUT the console application does not have this information available.  So when the SharePoint assemblies attempt to access this information they cannot because it does not exist.</p>
<p>The way around this is to create an HttpContext in your application before attempting to run <code>SPWeb.EnsureUser("blah")</code> like so:</p>
<pre>
<div class="code">
if (HttpContext.Current == null)
{
     HttpRequest request = new HttpRequest("", web.Url, "");
     HttpContext.Current = new HttpContext(request,
     new HttpResponse(new StringWriter()));
     HttpContext.Current.Items["HttpHandlerSPWeb"] = web;
}</div>
</pre>
<p>Then add the system.web/membership/providers node to your app.config file (which you may have to create in the project)..  Mine looks like so:</p>
<pre>
<div class="code">&lt;system.web&gt;
     &lt;membership&gt;
          &lt;providers&gt;
          &lt;add name="CustomSqlProvider" applicationName="/Portal"
            connectionStringName="sqlData"
            type="CustomProviders.CustomSqlMembershipProvider,
            CustomProviders, Version=1.0.0.0, Culture=neutral,
            PublicKeyToken=91a4fcd60b73a0e8" /&gt;
          &lt;/providers&gt;
     &lt;/membership&gt;
&lt;/system.web&gt;
&lt;connectionStrings&gt;
     &lt;add name="sqlData" connectionString="Data Source=sqlpd;
       Initial Catalog=PUsers; Integrated Security=True;
       MultipleActiveResultSets=True "
       providerName="System.Data.SqlClient" /&gt;
&lt;/connectionStrings&gt;</div>
</pre>
<p>After adding this information and running a few tests it started to work.  In fact it worked really well on my dev box...the only problem was it was a little intermittent on my production machine.  Which is funny because the provider on the site itself works just fine all the time but in order to get my console application working (the EnsureUser() portion) the site would require an IIS reset.  This is the one MAJOR stumbling block that I have yet to overcome...the only saving grace I have is that I can import the users manually into the system first using the UI and then run my console application that will load the sites and grant permissions to sites based on an external configuration file.</p>
<p>Many thanks to <a href="http://blog.mastykarz.nl"><cite>Waldek Mastykarz</cite></a> for all his help on this one so far...I know I will be coming back to this one in the near future but my head hurts a little and I need a beer.</p>
<p>Canadian SharePint event anyone?</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Development' rel='tag' target='_self'>Development</a>, <a class='technorati-link' href='http://technorati.com/tag/IIS' rel='tag' target='_self'>IIS</a>, <a class='technorati-link' href='http://technorati.com/tag/MembershipProvider' rel='tag' target='_self'>MembershipProvider</a>, <a class='technorati-link' href='http://technorati.com/tag/Security' rel='tag' target='_self'>Security</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/08/05/sharepoint-spweb-ensureuser-and-thecustom-membership-provider/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SharePoint Permissions</title>
		<link>http://www.calvinirwin.net/2009/07/29/sharepoint-permissions/</link>
		<comments>http://www.calvinirwin.net/2009/07/29/sharepoint-permissions/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 20:00:32 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Designer]]></category>
		<category><![CDATA[web parts]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=65</guid>
		<description><![CDATA[Inside the Microsoft.SharePoint namespace there is the SPBasePermissions enumeration.  It specifies the built-in permissions available in Windows SharePoint Services / MOSS 2007.  This was taken from the MSDN site, but I am posting it here because sometimes they move content around and I can't find it...ha ha you can't fool me Microsoft!!!
Using the enumerations [...]]]></description>
			<content:encoded><![CDATA[<p>Inside the Microsoft.SharePoint namespace there is the SPBasePermissions enumeration.  It specifies the built-in permissions available in Windows SharePoint Services / MOSS 2007.  This was taken from the MSDN site, but I am posting it here because sometimes they move content around and I can't find it...ha ha you can't fool me Microsoft!!!</p>
<p>Using the enumerations below you can wrap some markup on your page in an SPSecurityTrimmedControl like so: </p>
<div style="padding-left:15px; padding-top: 10px;  padding-bottom: 10px; font-family: courier new; color: #000099;">
&lt;Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="CreateGroups"&gt;</div>
<p>and only allow users with the defined permission to see the contents of the security trimming control.</p>
<table border="1">
<tbody>
<tr style="background-color:#3366CC;">
<th style="color: white;">Member name</th>
<th style="color: white;">Description</th>
</tr>
<tr>
<td><strong>AddAndCustomizePages</strong></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><strong>AddDelPrivateWebParts</strong></td>
<td>Add or remove personal Web Parts on a Web Part Page.</td>
</tr>
<tr>
<td><strong>AddListItems</strong></td>
<td>Add items to lists, add documents to document libraries, and add Web discussion comments.</td>
</tr>
<tr>
<td><strong>ApplyStyleSheets</strong></td>
<td>Apply a style sheet (.css file) to the Web site.</td>
</tr>
<tr>
<td><strong>ApplyThemeAndBorder</strong></td>
<td>Apply a theme or borders to the entire Web site.</td>
</tr>
<tr>
<td><strong>ApproveItems</strong></td>
<td>Approve a minor version of a list item or document.</td>
</tr>
<tr>
<td><strong>BrowseDirectories</strong></td>
<td>Enumerate files and folders in a Web site using Microsoft Office SharePoint Designer 2007 and WebDAV interfaces.</td>
</tr>
<tr>
<td><strong>BrowseUserInfo</strong></td>
<td>View information about users of the Web site.</td>
</tr>
<tr>
<td><strong>CancelCheckout</strong></td>
<td>Discard or check in a document which is checked out to another user.</td>
</tr>
<tr>
<td><strong>CreateAlerts</strong></td>
<td>Create e-mail alerts.</td>
</tr>
<tr>
<td><strong>CreateGroups</strong></td>
<td>Create a group of users that can be used anywhere within the site collection.</td>
</tr>
<tr>
<td><strong>CreateSSCSite</strong></td>
<td>Create a Web site using Self-Service Site Creation.</td>
</tr>
<tr>
<td><strong>DeleteListItems</strong></td>
<td>Delete items from a list, documents from a document library, and Web discussion comments in documents.</td>
</tr>
<tr>
<td><strong>DeleteVersions</strong></td>
<td>Delete past versions of a list item or document.</td>
</tr>
<tr>
<td><strong>EditListItems</strong></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><strong>EditMyUserInfo</strong></td>
<td>Allows a user to change his or her user information, such as adding a picture.</td>
</tr>
<tr>
<td><strong>EmptyMask</strong></td>
<td>Has no permissions on the Web site. Not available through the user interface.</td>
</tr>
<tr>
<td><strong>EnumeratePermissions</strong></td>
<td>Enumerate permissions on the Web site, list, folder, document, or list item.</td>
</tr>
<tr>
<td><strong>FullMask</strong></td>
<td>Has all permissions on the Web site. Not available through the user interface.</td>
</tr>
<tr>
<td><strong>ManageAlerts</strong></td>
<td>Manage alerts for all users of the Web site.</td>
</tr>
<tr>
<td><strong>ManageLists</strong></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><strong>ManagePermissions</strong></td>
<td>Create and change permission levels on the Web site and assign permissions to users and groups.</td>
</tr>
<tr>
<td><strong>ManagePersonalViews</strong></td>
<td>Create, change, and delete personal views of lists.</td>
</tr>
<tr>
<td><strong>ManageSubwebs</strong></td>
<td>Create subsites such as team sites, Meeting Workspace sites, and Document Workspace sites.</td>
</tr>
<tr>
<td><strong>ManageWeb</strong></td>
<td>Grant the ability to perform all administration tasks for the Web site as well as manage content. Activate, deactivate, or edit properties of Web site scoped Features through the object model or through the user interface (UI). When granted on the root Web site of a site collection, activate, deactivate, or edit properties of site collection scoped Features through the object model. To browse to the <strong>Site Collection Features</strong> page and activate or deactivate site collection scoped Features through the UI, you must be a site collection administrator.</td>
</tr>
<tr>
<td><strong>Open</strong></td>
<td>Allow users to open a Web site, list, or folder to access items inside that container.</td>
</tr>
<tr>
<td><strong>OpenItems</strong></td>
<td>View the source of documents with server-side file handlers.</td>
</tr>
<tr>
<td><strong>UpdatePersonalWebParts</strong></td>
<td>Update Web Parts to display personalized information.</td>
</tr>
<tr>
<td><strong>UseClientIntegration</strong></td>
<td>Use features that launch client applications; otherwise, users must work on documents locally and upload changes.</td>
</tr>
<tr>
<td><strong>UseRemoteAPIs</strong></td>
<td>Use SOAP, WebDAV, or Microsoft Office SharePoint Designer 2007 interfaces to access the Web site.</td>
</tr>
<tr>
<td><strong>ViewFormPages</strong></td>
<td>View forms, views, and application pages, and enumerate lists.</td>
</tr>
<tr>
<td><strong>ViewListItems</strong></td>
<td>View items in lists, documents in document libraries, and view Web discussion comments.</td>
</tr>
<tr>
<td><strong>ViewPages</strong></td>
<td>View pages in a Web site.</td>
</tr>
<tr>
<td><strong>ViewUsageData</strong></td>
<td>View reports on Web site usage.</td>
</tr>
<tr>
<td><strong>ViewVersions</strong></td>
<td>View past versions of a list item or document.</td>
</tr>
</tbody>
</table>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Development' rel='tag' target='_self'>Development</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint+Designer' rel='tag' target='_self'>SharePoint Designer</a>, <a class='technorati-link' href='http://technorati.com/tag/web+parts' rel='tag' target='_self'>web parts</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/29/sharepoint-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connecting to a SharePoint Standalone instance DB</title>
		<link>http://www.calvinirwin.net/2009/07/26/connecting-to-a-sharepoint-standalone-instance-db/</link>
		<comments>http://www.calvinirwin.net/2009/07/26/connecting-to-a-sharepoint-standalone-instance-db/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 19:30:02 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[sql server 2005]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=37</guid>
		<description><![CDATA[Kudos to Scott Elliott a colleague of mine for putting this together...
Here is how I got my SQL Express to remotely respond to SQL Management Studio.
In SQL Server Configuration Manager:
Under SQL Server 2005 Network Configuration:
Protocols for

 Enable Shared Memory
 Enable Name Pipes
 Enable TCP/IP

Under SQL Server 2005 Servers

 SQL Server (ServerInstance) Properties

Log on as: Local [...]]]></description>
			<content:encoded><![CDATA[<p>Kudos to Scott Elliott a colleague of mine for putting this together...</p>
<p>Here is how I got my SQL Express to remotely respond to SQL Management Studio.</p>
<p>In SQL Server Configuration Manager:<br />
Under SQL Server 2005 Network Configuration:<br />
Protocols for</p>
<ul>
<li> Enable Shared Memory</li>
<li> Enable Name Pipes</li>
<li> Enable TCP/IP</li>
</ul>
<p>Under SQL Server 2005 Servers</p>
<ul>
<li> SQL Server (ServerInstance) Properties</li>
</ul>
<p>Log on as: Local System (have to restart)<br />
SQL Server Browser</p>
<ul>
<li> Log on as: Local System (may have to enable this service first in the Services MMC applet)</li>
</ul>
<p>And with that, you should be able to remotely connect! Hazzah!</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Security' rel='tag' target='_self'>Security</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a>, <a class='technorati-link' href='http://technorati.com/tag/SQL+Server' rel='tag' target='_self'>SQL Server</a>, <a class='technorati-link' href='http://technorati.com/tag/sql+server+2005' rel='tag' target='_self'>sql server 2005</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/26/connecting-to-a-sharepoint-standalone-instance-db/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>403 Access Denied on SharePoint SSP Search setting access attempt</title>
		<link>http://www.calvinirwin.net/2009/07/26/403-access-denied-on-sharepoint-ssp-search-setting-access-attempt/</link>
		<comments>http://www.calvinirwin.net/2009/07/26/403-access-denied-on-sharepoint-ssp-search-setting-access-attempt/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 19:10:17 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=29</guid>
		<description><![CDATA[http://[your sspname here]/ssp/admin/_layouts/searchsspsettings.aspx
This problem has to do with an issue that comes up after you apply a hotfix to your servers. Essentially it enforces new security rules. To resolve it add the Sharepoint service account to the Box Administrators, WSS_ADMIN_WPG and WSS_RESTRICTED_WPG. Once this is done reset your IIS and you should be good to [...]]]></description>
			<content:encoded><![CDATA[<p>http://[your sspname here]/ssp/admin/_layouts/searchsspsettings.aspx</p>
<p>This problem has to do with an issue that comes up after you apply a hotfix to your servers. Essentially it enforces new security rules. To resolve it add the Sharepoint service account to the Box Administrators, WSS_ADMIN_WPG and WSS_RESTRICTED_WPG. Once this is done reset your IIS and you should be good to go.</p>
<p>Props to Søren Nielsen for the following post:<br />
<a href="http://soerennielsen.wordpress.com/2008/02/08/make-the-search-work-for-you/" target="_blank">http://soerennielsen.wordpress.com/2008/02/08/make-the-search-work-for-you/</a></p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Configuration' rel='tag' target='_self'>Configuration</a>, <a class='technorati-link' href='http://technorati.com/tag/search' rel='tag' target='_self'>search</a>, <a class='technorati-link' href='http://technorati.com/tag/Security' rel='tag' target='_self'>Security</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/26/403-access-denied-on-sharepoint-ssp-search-setting-access-attempt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Access Denied &#8211; Enabling Publishing Features in SharePoint</title>
		<link>http://www.calvinirwin.net/2009/07/26/access-denied-enabling-publishing-features-in-sharepoint/</link>
		<comments>http://www.calvinirwin.net/2009/07/26/access-denied-enabling-publishing-features-in-sharepoint/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 18:53:26 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[IIS]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=20</guid>
		<description><![CDATA[This is kind of of a weird error and it didn't make sense to me at first (still doesn't really). The best workaround I could find on the net was to temporarily change the application to run in the application pool of the central admin site.
Steps:

Change the AppPool for the app to be the same [...]]]></description>
			<content:encoded><![CDATA[<p>This is kind of of a weird error and it didn't make sense to me at first (still doesn't really). The best workaround I could find on the net was to temporarily change the application to run in the application pool of the central admin site.</p>
<p>Steps:</p>
<ol>
<li>Change the AppPool for the app to be the same as the Central Admin site (Home Directory tab in IIS website properties).</li>
<li>Reset IIS or at the very least do an %systemroot%\system32\iisapp.vbs /a "apppoolname" /r (not sure if the iisapp.vbs method will work but cant see why not).</li>
<li>Activate the publishing infrastructure.</li>
<li>Set the app pool back to normal.</li>
<li>repeat step 2.</li>
</ol>
<p>Enjoy!</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/error' rel='tag' target='_self'>error</a>, <a class='technorati-link' href='http://technorati.com/tag/IIS' rel='tag' target='_self'>IIS</a>, <a class='technorati-link' href='http://technorati.com/tag/Security' rel='tag' target='_self'>Security</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/26/access-denied-enabling-publishing-features-in-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
