2007/3/7, Vadlamani, Kalyan kalyan.vadlamani@ttu.edu:
I created an external authentication plug-in to get mediawiki
authenticated against external database...it works!!! I want mediawiki to automatically add the user once he/she is authenticated to its local database, and disable login/create user form. Any ideas how I should go about implementing this? Thanks in advance/
It is possible. We did just that, but we took a very tortuous way to avoid patching MediaWiki.
Basically we want our users to be able to go to any page of the wiki, and authenticate themselves, even if they are not in the wiki users table. Then we want them to get automatically inserted on this table. Additionaly, on each login we want their name, email and other information to be updated on the wiki. Also, we want their numeric ID on the wiki table to be the same as in our main user table. We were able to achieve all that and them some.
On initUser() we do a $dbw->commit to write the new user to the database and run an external function that updates the new user record, changing its ID (!) to be the same of our internal database, setting its password and name also from our user table, and so on. After this we change the $user object in memory so it will reflect the changes that were made to the database by that external function.
On the authenticate() function, we also call our external function to update the user name, e-mail, password and so on on the wiki table, according to the main user table.
We didn't exactly disable the login form, but we call it behind the scenes through a proxy web form. It simulates a post to the wiki login form and returns the resulting HTML.
To disable user account creation, there is a setting that you can put in LocalSettings.php:
$wgGroupPermissions['*']['createaccount'] = false;
It is worth noticing that because of a breaking change in version 1.9, you may be forced to have allowPasswordChange() return true during user creation.