Extension:Question2AnswerLogin

This extension allows users to log into mediawiki and automatically be logged into an instance of Question2Answer

To install q2a with mw single sign on -

Start with the instructions at

http://www.question2answer.org/single-sign-on.php

Perform all the steps up to and including step 6. For MySQL database name use the database name of your mediawiki install.

For step 7,edit the provided qa-external-users.php and use it in place of the included default question2answer file of the same name. If you're integrating with a mediawiki install that has different cookie settings than than a stock mw install add the correct ones.(you can find your cookie settings using the cookie editor for firefox).

Find the localsettings.php file in the root directory of your mw install and add a line to define the cookie domain. In the case of a website such as en.yourwebsite.org the setting would be

$wgCookieDomain = '.yourwebsite.org';

For local host this setting shouldn't matter and will work by leaving it empty

$wgCookieDomain = '';

Complete the q2a steps 8, 9 and 10 and test.

---

What's in qa-external-users.php -

I've added a few defines 11 to 24 - you can use these to adjust the cookie names and to enable the login/registration/logut links integration feature. Additionally I've added a few utility functions which are all prefixed wka_ - they should all be pretty self-explanatory.

The functions qa_ are the q2a integration interface. I've modified the required parts of the interface, that is, the functions:

function qa_get_mysql_user_column_type function qa_get_login_links($relative_url_prefix, $redirect_back_to_url) function qa_get_logged_in_user function qa_get_user_email($userid) function qa_get_userids_from_public($publicusernames)

You should not need to touch function qa_get_mysql_user_column_type

The rest are largely based on the examples provided in the original - before making significant changes to this code, you should review the original file as it contains extensive documentation and examples.

The real work happens in qa_get_logged_in_user and this is where the user role mapping happens. Line 80 defines the base level for regular mw users and lines 95 to 104 map mw sysops to q2a 'super admins'. Additional mappings could be added there, say, mw level 'bureaucrat' to q2a admins.

The rest of the qa_ interface is left in its default implementation - there are many more integration options in the interface and it seems fairly well documented.