Extension:AuthBugzilla

The goal of this extension is to offer user the same login and password in Bugzilla and Mediawiki, when installed on the same DB backend. The match between a Mediawiki user and a Bugzilla one is done via their email in the preferences, so make sure to force Mediawiki/Bugzilla to confirm users email at setup.

In short, with below extensions, if a given user has the same email in his Mediawiki profile and as login in Bugzilla:
 * the user can use its Mediawiki login and its Bugzilla password to log either to Mediawiki or Bugzilla
 * a password reset in either of the application will reset password in both applications
 * if the process fails for whatever reason (user has an account in Bugzilla but not Mediawiki, etc...), the authentication reverts to the usual process

Changes to the DBs

 * grant wikiuser the read/update rights to the bugzilla "profiles" table
 * grant bugzilla user the read right to your mediawiki "user" table (don't forget the table prefix if applicable).

Changes to Bugzilla
In Bugzilla\Auth\Verify\DB.pm, add the few lines between ####.

sub check_credentials { my ($self, $login_data) = @_; my $dbh = Bugzilla->dbh;

my $username = $login_data->{username};

####### Check if a Mediawiki login exists ########### # $login will only be used by the following SELECT statement, so it's safe. trick_taint($username); my $usernameMW = $dbh->selectrow_array("SELECT user_email FROM wikidb.user WHERE LOWER(user_name) = LOWER(?) and user_email_authenticated is not null",undef, $username); if ($usernameMW) { $username = $usernameMW; }   ####### End of Mediawiki check ########### my $user_id = login_to_id($username);

return { failure => AUTH_NO_SUCH_USER } unless $user_id;

AuthBugzilla.php
In LocalSettings.php, add these lines: require_once( 'extensions/AuthBugzilla.php' ); $wgAuth = new AuthBugzilla;

Add the file AuthBugzilla.php to your extensions directory (copy the following code and save it as AuthBugzilla.php):