<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Ryan Lane's Blog » extension</title>
	
	<link>http://ryandlane.com/blog</link>
	<description />
	<lastBuildDate>Thu, 29 Jul 2010 13:56:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/RyanLanesBlog_extension" /><feedburner:info uri="ryanlanesblog_extension" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://superfeedr.com/hubbub" /><item>
		<title>Using the LDAP Authentication Plugin for MediaWiki – The Basics (Part 3)</title>
		<link>http://feedproxy.google.com/~r/RyanLanesBlog_extension/~3/p-lnNIUFy6A/</link>
		<comments>http://ryandlane.com/blog/2009/07/09/using-the-ldap-authentication-plugin-for-mediawiki-%e2%80%93-the-basics-part-3/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 20:09:49 +0000</pubDate>
		<dc:creator>Ryan Lane</dc:creator>
				<category><![CDATA[LDAP]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[extension]]></category>

		<guid isPermaLink="false">http://ryandlane.com/wprdl/?p=148</guid>
		<description><![CDATA[In part 1 of this series, I discussed basic password authentication for Active Directory (AD). In this article I will discuss enabling group restrictions and synchronization, and retrieving preferences for AD. I&#8217;ll first discuss group restrictions, then synchronization, then retrieving preferences. Group restrictions and synchronization will require you to somewhat understand the LDAP structure that [...]


Related posts:<ol><li><a href='http://ryandlane.com/blog/2009/03/23/using-the-ldap-authentication-plugin-for-mediawiki-the-basics-part-1/' rel='bookmark' title='Permanent Link: Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 1)'>Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 1)</a></li>
<li><a href='http://ryandlane.com/blog/2009/06/16/using-the-ldap-authentication-plugin-for-mediawiki-the-basics-part-2/' rel='bookmark' title='Permanent Link: Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 2)'>Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 2)</a></li>
<li><a href='http://ryandlane.com/blog/2009/06/18/semi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension/' rel='bookmark' title='Permanent Link: Semi-anonymous users in MediaWiki using the LDAP Authentication extension'>Semi-anonymous users in MediaWiki using the LDAP Authentication extension</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>In <a href="../2009/03/23/using-the-ldap-authentication-plugin-for-mediawiki-the-basics-part-1/">part 1</a> of this series, I discussed basic password authentication for Active Directory (AD). In this article I will discuss enabling group restrictions and synchronization, and retrieving preferences for AD. I&#8217;ll first discuss group restrictions, then synchronization, then retrieving preferences.</p>
<p>Group restrictions and synchronization will require you to somewhat understand the LDAP structure that your AD environment is built upon. Don&#8217;t worry, this isn&#8217;t as scary as it sounds, and I&#8217;ll explain how to find all of the information you&#8217;ll require.</p>

<h2>Prerequisites</h2>
<p>Before you start, you must have authentication working. See <a href="../2009/03/23/using-the-ldap-authentication-plugin-for-mediawiki-the-basics-part-1/">part 1</a> of this series to enable authentication. Don&#8217;t try to get everything working at the same time. First ensure authentication is working, then enable group restrictions, then go from there.</p>
<p>For this article we will use the domain configured in part 1:</p>
<pre style="padding-left: 30px;">$wgLDAPDomainNames = array( "TESTAD" );</pre>
<h2>Group configuration</h2>
<h3>Shared group options</h3>
<h4>Telling the plugin how to map users to group members</h4>
<p>AD stores full Distinguished Names (DN)s like <em>cn=Ryan Lane,dc=testad,dc=example,dc=com</em> in groups, so we&#8217;ll need to tell the plugin to use full DNs. Also, we&#8217;ll need to tell the plugin how to get the user&#8217;s DN. Place the following in <strong>LocalSettings.php</strong>:</p>
<pre style="padding-left: 30px;"><span>$wgLDAPGroupUseFullDN</span> <span>=</span> <span>array</span><span>(</span> <span>"TESTAD"</span><span>=&gt;</span>true <span>)</span><span>;
</span><span>$wgLDAPBaseDNs</span> <span>=</span> <span>array</span><span>(</span> <span>'TESTAD'</span> <span>=&gt;</span> <span>'dc=testad,dc=example,dc=com'</span><span> )</span><span>;
</span><span>$wgLDAPSearchAttributes</span> <span>=</span> <span>array</span><span>(</span> <span>'TESTAD'</span> <span>=&gt;</span> <span>'sAMAccountName'</span> <span>);</span></pre>
<h4>Telling the plugin how to find users in groups</h4>
<p>For the plugin to find your groups, it needs to know how to search for them. There are two methods for doing this: The first (and easiest) way to do this is to use memberOf. The second way is to tell the plugin the attribute and objectclass used by the group, and the attribute used for member of the group.</p>
<h5>Using memberOf</h5>
<p>Currently, the plugin cannot find the primary group of a user using memberOf. If you need to restrict groups based on user&#8217;s primary groups, do not use memberOf. To enable memberOf for AD, put the following in <strong>LocalSettings.php</strong>:</p>
<pre style="padding-left: 30px;"><span>$wgLDAPGroupsUseMemberOf</span> <span>=</span> <span>array</span><span>(</span> "TESTAD" =&gt; true );</pre>
<h5>Manually configure the search</h5>
<p>Thankfully, most (all?) AD configurations use the same attributes and objectclasses for group membership, so this is fairly straightforward. Put the following into <strong>LocalSettings.php</strong>:</p>
<pre style="padding-left: 30px;"><span>//The objectclass of the groups we want to search for</span>
<span>$wgLDAPGroupObjectclass</span> <span>=</span> <span>array</span><span>(</span> <span>"TESTAD"</span><span>=&gt;</span><span>"group"</span> <span>)</span><span>;</span>

<span>//The attribute used for group members</span>
<span>$wgLDAPGroupAttribute</span> <span>=</span> <span>array</span><span>(</span> <span>"TESTAD"</span><span>=&gt;</span><span>"member"</span> <span>)</span><span>;</span>

<span>//The naming attribute of the group</span>
<span>$wgLDAPGroupNameAttribute</span> <span>=</span> <span>array</span><span>(</span> <span>"TESTAD"</span><span>=&gt;</span><span>"cn"</span> <span>)</span><span>;</span></pre>
<h3>Group restrictions</h3>
<p>The LDAP plugin supports two types of group restriction. The first is a list of groups a user is required to be a member of (required groups), the second is a list of groups a user cannot be a member of (excluded groups). Both types of restrictions can be used simultaneously.</p>
<h4>Required groups</h4>
<p>To require a user to be a member of a group (such as <em>cn=wiki-users,ou=groups,dc=testad,dc=example,dc=com</em>), put the following into <strong>LocalSettings.php</strong>:</p>
<pre style="padding-left: 30px;"><span>$wgLDAPRequiredGroups</span> <span>=</span> <span>array</span><span>(</span> "TESTAD"=&gt; array( "cn=wiki-users,ou=groups,dc=testad,dc=example,dc=com" ) );</pre>
<h4>Excluded groups</h4>
<p>To require a user to not be a member of a specific group (such as <em>cn=excluded-wiki-users,ou=groups,dc=testad,dc=example,dc=com</em>), put the following into <strong>LocalSettings.php</strong>:</p>
<pre style="padding-left: 30px;"><span>$wgLDAPExcludedGroups</span> <span>=</span> <span>array</span><span>(</span> "TESTAD"=&gt; array( "cn=excluded-wiki-users,ou=groups,dc=testad,dc=example,dc=com" ) );</pre>
<h3>Group synchronization</h3>
<p>Group synchronization allows you to manage MediaWiki authorization using groups defined in your AD server. To enable synchronization, simply add the following to LocalSettings.php:</p>
<pre style="padding-left: 30px;"><span>$wgLDAPUseLDAPGroups</span> <span>=</span> <span>array</span><span>(</span> <span>"TESTAD"</span><span>=&gt;</span>true );</pre>
<p>To use LDAP groups, you&#8217;ll have to define their permissions; say for instance you have a group called &#8220;wiki-users&#8221;, you could enable edit permissions for users in that group by adding the following to LocalSettings.php:</p>
<pre style="padding-left: 30px;"><span>$wgGroupPermissions</span><span>[</span><span>'wiki-users'</span><span>]</span><span>[</span><span>'edit'</span><span>]</span> <span>=</span> <span>true</span><span>;</span></pre>
<p>If you&#8217;d like to add sysop permissions to a group called &#8220;wiki-admins&#8221;, you could put the following into LocalSettings.php:</p>
<pre style="padding-left: 30px;"><span>$wgGroupPermissions</span><span>[</span><span>'wiki-admin'</span><span>] = </span><span>$wgGroupPermissions</span><span>[</span><span>'sysop'</span><span>]</span>;</pre>
<p>Overall, group synchronization is far more powerful than group restriction. See MediaWiki&#8217;s <a href="http://www.mediawiki.org/wiki/Manual:User_rights">user rights documentation</a> for more information on controlling access.</p>
<h2>Retrieving preferences</h2>
<p>The LDAP plugin can pull certain attributes from AD, and assign them to MediaWiki user preferences. The MediaWiki attributes currently available are <em>email</em>, <em>realname</em>, <em>nickname</em>, and <em>language</em>. You can configure which MediaWiki preference maps to which AD attribute; put the following in your LocalSettings.php to retrieve preferences:</p>
<pre style="padding-left: 30px;"><span>$wgLDAPPreferences</span> <span>=</span> <span>array</span><span>(</span> <span>"TESTAD"</span><span>=&gt;</span>array<span>(</span> <span>"email"</span><span>=&gt;</span><span>"mail"</span><span>,</span><span>"realname"</span><span>=&gt;</span><span>"cn"</span><span>,</span><span>"nickname"</span><span>=&gt;</span><span>"sAMAccountName"</span><span>,</span><span>"language"</span><span>=&gt;</span><span>"preferredLanguage"</span><span>)</span> <span>)</span><span>;</span></pre>
<h2>Finding user and group DNs, and object attributes</h2>
<p>To find the DN of a user in an AD group for use in any options mentioned above, use the <strong>dsquery</strong> command:</p>
<pre style="padding-left: 30px;">dsquery group -name "wiki-users"
<em>"cn=wiki-users,ou=groups,dc=testad,dc=example,dc=com"</em></pre>
<p>To get the value of specific attributes, use the <strong>dsquery</strong> command in conjunction with the <strong>dsget</strong> command:</p>
<pre style="padding-left: 30px;">dsquery user -name "test-user"
<em>"cn=test-user,ou=Domain Users,dc=testad,dc=example,dc=com"</em>
dsget "cn=test-user,ou=Domain Users,dc=testad,dc=example,dc=com" -upn
<em>  upn
  test-user@TESTAD.EXAMPLE.COM</em></pre>
<p>You can get a lot of information with these commands; to find out what else you can find, see the help documentation using <strong>dsquery /?</strong>.</p>
<h2>Test your configuration by logging in with an LDAP user</h2>
<p>If you are doing group synchronization, you should ensure users are being correctly added and removed from MediaWiki groups when they are being added and removed from your AD groups. If you are retrieving preferences, you should ensure they are being updated when you log in.</p>
<p>If you have any questions, you should post them on the <a href="http://www.mediawiki.org/wiki/Extension_talk:LDAP_Authentication">discussion page for the plugin</a> on mediawiki.org, or leave me a comment (the former is preferred).</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Share:</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F07%2F09%2Fusing-the-ldap-authentication-plugin-for-mediawiki-%25e2%2580%2593-the-basics-part-3%2F&amp;submitHeadline=Using+the+LDAP+Authentication+Plugin+for+MediaWiki+%E2%80%93+The+Basics+%28Part+3%29&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F07%2F09%2Fusing-the-ldap-authentication-plugin-for-mediawiki-%25e2%2580%2593-the-basics-part-3%2F&amp;title=Using+the+LDAP+Authentication+Plugin+for+MediaWiki+%E2%80%93+The+Basics+%28Part+3%29" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F07%2F09%2Fusing-the-ldap-authentication-plugin-for-mediawiki-%25e2%2580%2593-the-basics-part-3%2F&amp;title=Using+the+LDAP+Authentication+Plugin+for+MediaWiki+%E2%80%93+The+Basics+%28Part+3%29" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F07%2F09%2Fusing-the-ldap-authentication-plugin-for-mediawiki-%25e2%2580%2593-the-basics-part-3%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F07%2F09%2Fusing-the-ldap-authentication-plugin-for-mediawiki-%25e2%2580%2593-the-basics-part-3%2F&amp;title=Using+the+LDAP+Authentication+Plugin+for+MediaWiki+%E2%80%93+The+Basics+%28Part+3%29" rel="nofollow" title="Add to&nbsp;LinkedIn"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Add to&nbsp;LinkedIn" alt="Add to&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F07%2F09%2Fusing-the-ldap-authentication-plugin-for-mediawiki-%25e2%2580%2593-the-basics-part-3%2F&amp;title=Using+the+LDAP+Authentication+Plugin+for+MediaWiki+%E2%80%93+The+Basics+%28Part+3%29" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F07%2F09%2Fusing-the-ldap-authentication-plugin-for-mediawiki-%25e2%2580%2593-the-basics-part-3%2F&amp;title=Using+the+LDAP+Authentication+Plugin+for+MediaWiki+%E2%80%93+The+Basics+%28Part+3%29" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F07%2F09%2Fusing-the-ldap-authentication-plugin-for-mediawiki-%25e2%2580%2593-the-basics-part-3%2F&amp;title=Using+the+LDAP+Authentication+Plugin+for+MediaWiki+%E2%80%93+The+Basics+%28Part+3%29" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Using+the+LDAP+Authentication+Plugin+for+MediaWiki+%E2%80%93+The+Basics+%28Part+3%29+@+http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F07%2F09%2Fusing-the-ldap-authentication-plugin-for-mediawiki-%25e2%2580%2593-the-basics-part-3%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://ryandlane.com/blog/2009/03/23/using-the-ldap-authentication-plugin-for-mediawiki-the-basics-part-1/' rel='bookmark' title='Permanent Link: Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 1)'>Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 1)</a></li>
<li><a href='http://ryandlane.com/blog/2009/06/16/using-the-ldap-authentication-plugin-for-mediawiki-the-basics-part-2/' rel='bookmark' title='Permanent Link: Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 2)'>Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 2)</a></li>
<li><a href='http://ryandlane.com/blog/2009/06/18/semi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension/' rel='bookmark' title='Permanent Link: Semi-anonymous users in MediaWiki using the LDAP Authentication extension'>Semi-anonymous users in MediaWiki using the LDAP Authentication extension</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/RyanLanesBlog_extension/~4/p-lnNIUFy6A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ryandlane.com/blog/2009/07/09/using-the-ldap-authentication-plugin-for-mediawiki-%e2%80%93-the-basics-part-3/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		<feedburner:origLink>http://ryandlane.com/blog/2009/07/09/using-the-ldap-authentication-plugin-for-mediawiki-%e2%80%93-the-basics-part-3/</feedburner:origLink></item>
		<item>
		<title>Semi-anonymous users in MediaWiki using the LDAP Authentication extension</title>
		<link>http://feedproxy.google.com/~r/RyanLanesBlog_extension/~3/ccp7lerT1B4/</link>
		<comments>http://ryandlane.com/blog/2009/06/18/semi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 15:27:53 +0000</pubDate>
		<dc:creator>Ryan Lane</dc:creator>
				<category><![CDATA[LDAP]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[extension]]></category>

		<guid isPermaLink="false">http://ryandlane.com/wprdl/?p=142</guid>
		<description><![CDATA[For some corporate wikis, it is beneficial to allow anonymous edits; however, anonymous edits in MediaWiki track IP addresses, and in most corporate environments, it is simple to identify a user simply by knowing what IP address they came from. Also, most corporate environments are opposed to allowing non-authenticated write-access to any resource (for good [...]


Related posts:<ol><li><a href='http://ryandlane.com/blog/2009/07/09/using-the-ldap-authentication-plugin-for-mediawiki-%e2%80%93-the-basics-part-3/' rel='bookmark' title='Permanent Link: Using the LDAP Authentication Plugin for MediaWiki – The Basics (Part 3)'>Using the LDAP Authentication Plugin for MediaWiki – The Basics (Part 3)</a></li>
<li><a href='http://ryandlane.com/blog/2009/03/23/using-the-ldap-authentication-plugin-for-mediawiki-the-basics-part-1/' rel='bookmark' title='Permanent Link: Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 1)'>Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 1)</a></li>
<li><a href='http://ryandlane.com/blog/2009/06/16/using-the-ldap-authentication-plugin-for-mediawiki-the-basics-part-2/' rel='bookmark' title='Permanent Link: Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 2)'>Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 2)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>For some corporate wikis, it is beneficial to allow anonymous edits; however, anonymous edits in MediaWiki track IP addresses, and in most corporate environments, it is simple to identify a user simply by knowing what IP address they came from. Also, most corporate environments are opposed to allowing non-authenticated write-access to any resource (for good reason).</p>
<p>So, if you wanted to have a wiki, like a wiki for polls, that needed some form of anonymity for users to trust using it, using the LDAP Authentication extension in a clever way can allow you to do this.</p>

<h2>Enable the extension and test authentication</h2>
<p>First and foremost, you should ensure that LDAP authentication is configured and working properly; see <a href="http://ryandlane.com/wprdl/2009/03/23/using-the-ldap-authentication-plugin-for-mediawiki-the-basics-part-1/">part 1</a> and <a href="http://ryandlane.com/wprdl/2009/06/16/using-the-ldap-authentication-plugin-for-mediawiki-the-basics-part-2/">part 2</a> of the series of articles for using the LDAP plugin for MediaWiki.</p>
<h2>Configure the SetUsernameAttributeFromLDAP hook</h2>
<p>The LDAP extension has a configuration hook that allows you to set the username used in MediaWiki to any of the user&#8217;s attributes in LDAP. We&#8217;ll use this to create a semi-anonymous username based off one of the user&#8217;s attributes.</p>
<p>Notice that I am saying <em>semi</em>-anonymous for a reason. Unless you want to create a new user for someone every time they log in, you have to create the username in such a way that it is the same every time. Put the following into the bottom of <strong>LocalSettings.php</strong>:</p>
<pre style="padding-left: 30px;">// This hook is called by the LdapAuthentication plugin. It is a configuration hook. Here we
// are specifying what attibute we want to use for a username in the wiki.
// The hook calls the function defined below.
$wgHooks['SetUsernameAttributeFromLDAP'][] = 'SetUsernameAttribute';

// This function allows you to get the username from LDAP however you need to do it.
function SetUsernameAttribute(&amp;$LDAPUsername, $info) {
    $LDAPUsername = $info[0]['cn'][0];
    $LDAPUsername = $LDAPUsername . "MySuperSecretAppendedString0230932740982738khewfjkshd";
    // How usernames are created should not be disclosed, otherwise
    // the psuedo-anonymity will be lost.
    $LDAPUsername = 'pseudo.' . md5($LDAPUsername);
    // All hooks have to return a boolean in MediaWiki
    return true;
}</pre>
<p>You should change the attribute pulled, the &#8220;MySuperSecret&#8230;&#8221; string, and (possibly) the hashing function to something else. You should probably leave the &#8220;pseudo.&#8221; string alone. Notice that it is important that whatever hash function you use creates a username that is allowed by MediaWiki; I am using md5 above for this reason.</p>
<p>As you can see, the wiki system administrator, and anyone else that knows how you are hashing the usernames, can figure out who anonymous users are. It is important to keep this information secret.</p>
<h2>Test login to ensure the username gets hashed</h2>
<p>When you log in, you should have a semi-anonymous username. Log out and log in again; you should have the same semi-anonymous username; if not, your hashing function isn&#8217;t working properly.</p>
<h2>Give your semi-anonymous user admin privileges</h2>
<p>Notice that every user, including your admin user, is now semi-anonymous. Unfortunately, this means you are no longer an admin. To fix this:</p>
<ol>
<li> Log out</li>
<li>Disable the semi-anonymous configuration</li>
<li>Log in as your admin user</li>
<li>Give admin privileges to your new semi-anonymous user</li>
<li>(Optionally) merge your old admin user with your new semi-anonymous user</li>
</ol>
<p>I should probably mention that your admin user will likely no longer be anonymous after giving yourself admin privileges (after all, most people probably know who the wiki admin is).</p>
<p>An alternative to these steps is to not hash your admin&#8217;s username in the above function.</p>
<h2>Feedback</h2>
<p>Let me know if this is or isn&#8217;t working for you, or if you have a better way of making users anonymous.</p>
<p><strong>Update (06/29/2009): </strong>Looks like this isn&#8217;t working right now unless you are using auto-authentication. I&#8217;ll try to have an update for the LDAP extension soon that&#8217;ll address this.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Share:</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F18%2Fsemi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension%2F&amp;submitHeadline=Semi-anonymous+users+in+MediaWiki+using+the+LDAP+Authentication+extension&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F18%2Fsemi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension%2F&amp;title=Semi-anonymous+users+in+MediaWiki+using+the+LDAP+Authentication+extension" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F18%2Fsemi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension%2F&amp;title=Semi-anonymous+users+in+MediaWiki+using+the+LDAP+Authentication+extension" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F18%2Fsemi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F18%2Fsemi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension%2F&amp;title=Semi-anonymous+users+in+MediaWiki+using+the+LDAP+Authentication+extension" rel="nofollow" title="Add to&nbsp;LinkedIn"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Add to&nbsp;LinkedIn" alt="Add to&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F18%2Fsemi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension%2F&amp;title=Semi-anonymous+users+in+MediaWiki+using+the+LDAP+Authentication+extension" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F18%2Fsemi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension%2F&amp;title=Semi-anonymous+users+in+MediaWiki+using+the+LDAP+Authentication+extension" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F18%2Fsemi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension%2F&amp;title=Semi-anonymous+users+in+MediaWiki+using+the+LDAP+Authentication+extension" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Semi-anonymous+users+in+MediaWiki+using+the+LDAP+Authentication+extension+@+http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F18%2Fsemi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://ryandlane.com/blog/2009/07/09/using-the-ldap-authentication-plugin-for-mediawiki-%e2%80%93-the-basics-part-3/' rel='bookmark' title='Permanent Link: Using the LDAP Authentication Plugin for MediaWiki – The Basics (Part 3)'>Using the LDAP Authentication Plugin for MediaWiki – The Basics (Part 3)</a></li>
<li><a href='http://ryandlane.com/blog/2009/03/23/using-the-ldap-authentication-plugin-for-mediawiki-the-basics-part-1/' rel='bookmark' title='Permanent Link: Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 1)'>Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 1)</a></li>
<li><a href='http://ryandlane.com/blog/2009/06/16/using-the-ldap-authentication-plugin-for-mediawiki-the-basics-part-2/' rel='bookmark' title='Permanent Link: Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 2)'>Using the LDAP Authentication Plugin for MediaWiki &#8211; The Basics (Part 2)</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/RyanLanesBlog_extension/~4/ccp7lerT1B4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ryandlane.com/blog/2009/06/18/semi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://ryandlane.com/blog/2009/06/18/semi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension/</feedburner:origLink></item>
		<item>
		<title>Announcing the Plotters extension for MediaWiki</title>
		<link>http://feedproxy.google.com/~r/RyanLanesBlog_extension/~3/1kbr4yz78SM/</link>
		<comments>http://ryandlane.com/blog/2009/06/08/announcing-the-plotters-extension-for-mediawiki/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 17:15:34 +0000</pubDate>
		<dc:creator>Ryan Lane</dc:creator>
				<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[extension]]></category>

		<guid isPermaLink="false">http://ryandlane.com/wprdl/?p=108</guid>
		<description><![CDATA[The Plotters extension for MediaWiki allows wiki editors to visualize data using scripts created by administrators. Scripts are added in a way similar to the Gadgets extension. Three types of scripts are available: helpers, preprocessors. and plotters. The script types are loaded in that order so that helpers can be used in preprocessors and plotters, [...]


Related posts:<ol><li><a href='http://ryandlane.com/blog/2009/06/18/semi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension/' rel='bookmark' title='Permanent Link: Semi-anonymous users in MediaWiki using the LDAP Authentication extension'>Semi-anonymous users in MediaWiki using the LDAP Authentication extension</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The Plotters extension for MediaWiki allows wiki editors to visualize data using scripts created by administrators. Scripts are added in a way similar to the <a href="http://www.mediawiki.org/wiki/Extension:Gadgets">Gadgets extension</a>.</p>
<p>Three types of scripts are available: helpers, preprocessors. and plotters. The script types are loaded in that order so that helpers can be used in preprocessors and plotters, and so that data can be preprocesed before it is plotted.</p>
<p>Wiki editors can use these scripts by using the plot parser function, or tag:</p>
<pre>{{#plot:
|renderer=plotkit
|name=&lt;uniquename&gt;
|width=300
|height=300
|script=&lt;scriptname&gt;
|scriptarguments=arg1,arg2,...
|preprocessors=&lt;preprocessorname1&gt;,&lt;preprocessorname2&gt;,...
|preprocessorarguments=&lt;preprocessor1argument1&gt;,&lt;preprocessor1argument2&gt;,...:preprocessor2argument1&gt;,&lt;preprocessor2argument2&gt;,...:...,...
|labels=label1,label2
|datasep=,
|tableclass=wikitable
|data=1,2
2,4}}</pre>
<p>or a simpler example:</p>
<pre>{{#plot:
|renderer=plotkit
|script=bar
|labels=label1,label2
|data=1,2
2,4}}</pre>
<p>Only scripts used in pages are loaded; so, download sizes should be reasonable. ExplorerCanvas is always included for IE support. If javascript is disabled, a table is shown with the raw data; the CSS class that is used for the table can be user defined with the tableclass argument.</p>
<p>Administrators can add and remove available renderers and javascript via configuration options. By default, the plotkit renderer is defined. A default generic renderer is always available that simply outputs a canvas element.</p>
<p>See the <a href="http://www.mediawiki.org/wiki/Extension:Plotters">Plotters extension page on mediawiki.org</a> for more information. See <a href="http://ryandlane.com/sandbox/Plotters">my sandbox for examples</a>. Bug reports can be placed on the extension&#8217;s discussion page, posted as a comment on this blog, or sent to me via email. Post all support questions on the extension&#8217;s discussion page.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Share:</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F08%2Fannouncing-the-plotters-extension-for-mediawiki%2F&amp;submitHeadline=Announcing+the+Plotters+extension+for+MediaWiki&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F08%2Fannouncing-the-plotters-extension-for-mediawiki%2F&amp;title=Announcing+the+Plotters+extension+for+MediaWiki" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F08%2Fannouncing-the-plotters-extension-for-mediawiki%2F&amp;title=Announcing+the+Plotters+extension+for+MediaWiki" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F08%2Fannouncing-the-plotters-extension-for-mediawiki%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F08%2Fannouncing-the-plotters-extension-for-mediawiki%2F&amp;title=Announcing+the+Plotters+extension+for+MediaWiki" rel="nofollow" title="Add to&nbsp;LinkedIn"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Add to&nbsp;LinkedIn" alt="Add to&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F08%2Fannouncing-the-plotters-extension-for-mediawiki%2F&amp;title=Announcing+the+Plotters+extension+for+MediaWiki" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F08%2Fannouncing-the-plotters-extension-for-mediawiki%2F&amp;title=Announcing+the+Plotters+extension+for+MediaWiki" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F08%2Fannouncing-the-plotters-extension-for-mediawiki%2F&amp;title=Announcing+the+Plotters+extension+for+MediaWiki" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Announcing+the+Plotters+extension+for+MediaWiki+@+http%3A%2F%2Fryandlane.com%2Fblog%2F2009%2F06%2F08%2Fannouncing-the-plotters-extension-for-mediawiki%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://ryandlane.com/blog/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://ryandlane.com/blog/2009/06/18/semi-anonymous-users-in-mediawiki-using-the-ldap-authentication-extension/' rel='bookmark' title='Permanent Link: Semi-anonymous users in MediaWiki using the LDAP Authentication extension'>Semi-anonymous users in MediaWiki using the LDAP Authentication extension</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/RyanLanesBlog_extension/~4/1kbr4yz78SM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ryandlane.com/blog/2009/06/08/announcing-the-plotters-extension-for-mediawiki/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ryandlane.com/blog/2009/06/08/announcing-the-plotters-extension-for-mediawiki/</feedburner:origLink></item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached
Page Caching using memcached
Database Caching 84/157 queries in 0.239 seconds using memcached
Object Caching 0/0 objects using memcached

Served from: ryandlane.com @ 2010-07-30 15:17:32 -->
