From f0678e088ced13d14237e6762c951e9251137ba7 Mon Sep 17 00:00:00 2001
From: Bradley M. Froehle <brad.froehle@gmail.com>
Date: Tue, 12 Apr 2011 17:29:45 -0700
Subject: [PATCH] Issue #1125460: Enable Single Sign-Out by default.

---
 cas.admin.inc |    7 -------
 cas.install   |    6 +++++-
 cas.module    |    4 ++--
 cas.test      |    5 -----
 4 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/cas.admin.inc b/cas.admin.inc
index 51df021..8b6e37e 100644
--- a/cas.admin.inc
+++ b/cas.admin.inc
@@ -128,13 +128,6 @@ function cas_admin_settings() {
     '#description' => t("Only needed if 'Use CAS proxy initializer' is configured. Leave empty for default."),
   );
 
-  $form['server']['cas_signout'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Enable CAS Single Sign Out (CAS server 3.1 or greater)'),
-    '#default_value' => variable_get('cas_signout', FALSE),
-    '#description' => t('For more details see <a href="http://www.ja-sig.org/wiki/display/CASUM/Single+Sign+Out">http://www.ja-sig.org/wiki/display/CASUM/Single+Sign+Out</a>.'),
-  );
-
   $form['server']['cas_debugfile'] = array(
     '#type' => 'textfield',
     '#title' => t('CAS debugging output filename'),
diff --git a/cas.install b/cas.install
index e21fc72..1e2ae33 100644
--- a/cas.install
+++ b/cas.install
@@ -102,7 +102,6 @@ function cas_uninstall() {
   variable_del('cas_proxy');
   variable_del('cas_registerURL');
   variable_del('cas_server');
-  variable_del('cas_signout');
   variable_del('cas_uri');
   variable_del('cas_user_register');
   variable_del('cas_version');
@@ -112,6 +111,7 @@ function cas_uninstall() {
   variable_del('cas_hijack_user');
   variable_del('cas_ldap_email_attribute');
   variable_del('cas_logout_redirect');
+  variable_del('cas_signout');
   variable_del('cas_useldap');
   variable_del('cas_useldap_groups');
   variable_del('cas_verify');
@@ -308,6 +308,10 @@ function cas_update_6303() {
   }
   variable_del('cas_logout_redirect');
 
+  // Also remove the variable controlling CAS Single Sign-Out which is now
+  // always enabled.
+  variable_del('cas_signout');
+
   return array();
 }
 
diff --git a/cas.module b/cas.module
index 0d7914f..e5b2a5c 100644
--- a/cas.module
+++ b/cas.module
@@ -141,7 +141,7 @@ function cas_login_check() {
     // final check to make sure we have a good user
     if ($account && $account->uid > 0) {
       // Save single sign out information
-      if (!empty($_SESSION['cas_ticket']) && variable_get('cas_signout', FALSE)) {
+      if (!empty($_SESSION['cas_ticket'])) {
         _cas_single_sign_out_save_token($account);
       }
 
@@ -971,7 +971,7 @@ function cas_login_submit(&$form, &$form_state) {
 }
 
 function _cas_single_sign_out_check() {
-  if (variable_get('cas_signout', FALSE) && array_key_exists("logoutRequest", $_POST)) {
+  if (isset($_POST["logoutRequest"])) {
     $cas_logout_request_xml_string = utf8_encode($_POST["logoutRequest"]);     // it's important!
     $cas_logout_request_xml = new SimpleXMLElement($cas_logout_request_xml_string);
     if (is_object($cas_logout_request_xml)) {
diff --git a/cas.test b/cas.test
index 9b3f5cf..ba52f92 100644
--- a/cas.test
+++ b/cas.test
@@ -537,11 +537,6 @@ class CasSingleSignOutTestCase extends CasTestHelper {
     );
   }
 
-  function setUp() {
-    parent::setUp();
-    variable_set('cas_signout', TRUE);
-  }
-
   function testSingleSignOut() {
     // Create a user, and log in.
     $cas_name = $this->randomName();
-- 
1.7.4.1

