You are here

function cas_server_logout in CAS 6.3

Same name and namespace in other branches
  1. 5.4 cas_server.module \cas_server_logout()
  2. 5.3 cas_server.module \cas_server_logout()
  3. 6.2 cas_server.module \cas_server_logout()
  4. 7 cas_server.module \cas_server_logout()

Menu callback; triggers a CAS logout.

1 string reference to 'cas_server_logout'
cas_server_menu in ./cas_server.module
Implementation of hook_menu

File

./cas_server.module, line 241
Provides a protocol compliant version of CAS server 2.x

Code

function cas_server_logout() {
  global $user;
  watchdog('user', 'Session closed for %name.', array(
    '%name' => $user->name,
  ));

  // Destroy the current session:
  session_destroy();

  // Only variables can be passed by reference workaround.
  $null = NULL;
  user_module_invoke('logout', $null, $user);

  // Load the anonymous user
  $user = drupal_anonymous_user();
  $output = '<p>' . t('You have been logged out successfully.') . '</p>';
  if (isset($_REQUEST['url'])) {
    $output .= '<p>' . l(t('Continue'), $_REQUEST['url']) . '</p>';
  }
  return $output;
}