Forums | Mahara Community

Mahara/Moodle integration /
Logout Issue


anonymous profile picture
Account deleted
Posts: 41

28 September 2011, 6:41

Hello Everyone,

While working with Mahara 1.4 and Moodle 2.0 and after the
SSO is fully functional (users roam to moodle without problems). When the user
logs out from Mahara they are not logged out from moodle as well. This caused a
problem that we managed to solve. So we thought we have to mention this thing.

Best,

Mohammad

anonymous profile picture
Account deleted
Posts: 214

28 September 2011, 10:33

Hi Mohammad,

How did you manage to solve the problem and which SSO plugin are you using?

I would guess that when you logout of mahara, the authentication mechanism's logout hook is not called, or there is something preventing the SSO system from performing the logout (misconfiguration or bug).

Andrew 

anonymous profile picture
Account deleted
Posts: 1

29 September 2011, 4:27

Hi Andrew

I have worked on this with Mohammad, here is how it works:

At the end of logout function in Mahara (located in /auth/user.php), make it redirects the user to a new page in Moodle which should logs out the user, I created a new one in Moodle root directory and called it logout.php, this is the code inside it:

require_once dirname(__FILE__) . '/config.php';
//param in URL. Used for redirecting back to Mahara
$url = optional_param('url', '', PARAM_RAW);

require_logout(); // This function logs the current user out
redirect($url); // Return back to Mahara Home page.

Of course you redirect to Moodle/logout.php page like this:

redirect('<MoodleDomain>/logout.php?url='.urlencode(get_config('wwwroot')));

There is one proglem in this, you should guarantee that both users on Moodle and Mahara are the same, otherwise you will logout a different user, we have this already solved because our users cannot login Moodle but to login Mahara first; then they are logged in to Moodle automatically.

Please tell us if you have any comments about this.

Regards

anonymous profile picture
Account deleted
Posts: 214

29 September 2011, 9:46

Hi Khaled,

I believe that the correct way to do this would be in the auth mechanism itself. There's a logout() function you can define in your auth mech (defined in the parent class at auth/lib.php) which can be used to do anything required on logout.

For an example of where this is done already to log users out of moodle, when they log out of mahara, see auth/xmlrpc/lib.php in the AuthXmlrpc class->logout().

Andrew

4 results