--- /Users/jeff/Desktop/cas-patched/cas.module 2007-05-17 16:56:56.000000000 -0700 +++ cas.module 2007-05-17 17:04:46.000000000 -0700 @@ -94,7 +94,7 @@ function cas_init() { // now save the user and become the new user. $user = user_save("", $user_default); - watchdog("user", "new user: $user->name (CAS)", l(t("edit user"), "admin/user/edit/$user->uid")); + watchdog("user", t('new user: %n (CAS)', array('%n' => $user->name)), WATCHDOG_NOTICE, l(t("edit user"), "admin/user/edit/$user->uid")); if(($user->uid) && ($user->uid > 0) && $cas_authmap) { unset($_SESSION['cas_goto']); @@ -217,19 +217,86 @@ function cas_menu($may_cache) { */ function cas_admin_settings() { - $form['server'] = array('#type' => 'fieldset', '#title' => t('CAS server settings'),'#collapsible' => true,'#collapsed' => false ); - $form['server']['cas_version'] = array('#type' => 'radios', '#title' => t('CAS Version'), '#default_value' => variable_get('cas_version', '2.0'), '#options' => array('1.0' => '1.0', '2.0' => '2.0')); - $form['server']['cas_server'] = array('#type' => 'textfield', '#title' => t('Cas Server'), '#default_value' => variable_get('cas_server', ''), '#size' => 30,'#maxlength' => 55, '#description' => t('Location of CAS authentication Service')); - $form['server']['cas_port'] = array('#type' => 'textfield', '#title' => t('CAS Port'), '#default_value' => variable_get('cas_port', '443'), '#size' => 30, '#maxlength' => 8, '#description' => '443 is the standard ssl port; 8443 is the standard non-root port for Tomcat'); - $form['server']['cas_uri'] = array('#type' => 'textfield', '#title' => t('CAS URI'), '#default_value' => variable_get('cas_uri', ''), '#size' => 30, '#description' => 'If CAS is not at the root of the host, include a URI (e.g., /cas)'); - $form['account'] = array('#type' => 'fieldset', '#title' => t('User account settings'),'#collapsible' => true,'#collapsed' => true); - $form['account']['cas_authmap'] = array('#type' => 'checkbox', '#title' => t('Is Drupal also the CAS user repository?'), '#default_value' => variable_get('cas_authmap', 0), '#description' => t('In most cases, the answer will be no; an LDAP repository will be the source of CAS users. But in some cases, the Drupal user database could be used as the central user store for single sign-on. If this is the case, select this option.')); - $form['account']['cas_hijack_user'] = array('#type' => 'checkbox', '#title' => t('If CAS is not the user repository, should cas highjack users with the same name?'), '#default_value' => variable_get('cas_hijack_user', 0), '#description' => t('If you have pre-created regular accounts in cas that you want converted to mapped accounts, check this box. Otherwise cas will likely throw duplicate key violation errors on new users.')); - $form['account']['cas_user_register'] = array('#type' => 'checkbox', '#title' => t('Should Drupal user accounts be automatically created?'), '#default_value' => variable_get('cas_user_register', 1), '#description' => t('If a CAS user logs in, his Drupal account will automatically be created. If you don\'t check this option, you will have to pre-create accounts for the users you want to allow.')); - $form['account']['cas_domain'] = array('#type' => 'textfield', '#title' => t('Email Domain'), '#default_value' => variable_get('cas_domain', ''), '#size' => 30,'#maxlength' => 55, '#description' => t('Append this domain name to each new user in order generate his email address.')); - $form['account']['cas_hide_email'] = array('#type' => 'checkbox', '#title' => t('Users canot change email address'), '#default_value' => variable_get('cas_hide_email', 0), '#description' => t('Hide email address field on the edit user form')); - $form['account']['cas_hide_password'] = array('#type' => 'checkbox', '#title' => t('Users canot change password'), '#default_value' => variable_get('cas_hide_password', 0), '#description' => t('Hides password field on the edit user form')); + $form['server'] = array( + '#type' => 'fieldset', + '#title' => t('CAS server settings'), + '#collapsible' => true, + '#collapsed' => false + ); + $form['server']['cas_version'] = array( + '#type' => 'radios', + '#title' => t('CAS Version'), + '#default_value' => variable_get('cas_version', '2.0'), + '#options' => array('1.0' => '1.0', '2.0' => '2.0') + ); + $form['server']['cas_server'] = array( + '#type' => 'textfield', + '#title' => t('Cas Server'), + '#default_value' => variable_get('cas_server', ''), + '#size' => 30, + '#maxlength' => 55, + '#description' => t('Location of CAS authentication Service') + ); + $form['server']['cas_port'] = array( + '#type' => 'textfield', + '#title' => t('CAS Port'), + '#default_value' => variable_get('cas_port', '443'), + '#size' => 30, + '#maxlength' => 8, + '#description' => t('443 is the standard ssl port; 8443 is the standard non-root port for Tomcat') + ); + $form['server']['cas_uri'] = array( + '#type' => 'textfield', + '#title' => t('CAS URI'), + '#default_value' => variable_get('cas_uri', ''), + '#size' => 30, + '#description' => t('If CAS is not at the root of the host, include a URI (e.g., /cas)') + ); + $form['account'] = array( + '#type' => 'fieldset', + '#title' => t('User account settings'), + '#collapsible' => true, + '#collapsed' => true + ); + $form['account']['cas_authmap'] = array( + '#type' => 'checkbox', + '#title' => t('Is Drupal also the CAS user repository?'), + '#default_value' => variable_get('cas_authmap', 0), + '#description' => t('In most cases, the answer will be no; an LDAP repository will be the source of CAS users. But in some cases, the Drupal user database could be used as the central user store for single sign-on. If this is the case, select this option.') + ); + $form['account']['cas_hijack_user'] = array( + '#type' => 'checkbox', + '#title' => t('If CAS is not the user repository, should cas highjack users with the same name?'), + '#default_value' => variable_get('cas_hijack_user', 0), + '#description' => t('If you have pre-created regular accounts in cas that you want converted to mapped accounts, check this box. Otherwise cas will likely throw duplicate key violation errors on new users.') + ); + $form['account']['cas_user_register'] = array( + '#type' => 'checkbox', + '#title' => t('Should Drupal user accounts be automatically created?'), + '#default_value' => variable_get('cas_user_register', 1), + '#description' => t('If a CAS user logs in, his Drupal account will automatically be created. If you don\'t check this option, you will have to pre-create accounts for the users you want to allow.') + ); + $form['account']['cas_domain'] = array( + '#type' => 'textfield', + '#title' => t('Email Domain'), + '#default_value' => variable_get('cas_domain', ''), + '#size' => 30, + '#maxlength' => 55, + '#description' => t('Append this domain name to each new user in order generate his email address.') + ); + $form['account']['cas_hide_email'] = array( + '#type' => 'checkbox', + '#title' => t('Users canot change email address'), + '#default_value' => variable_get('cas_hide_email', 0), + '#description' => t('Hide email address field on the edit user form') + ); + $form['account']['cas_hide_password'] = array( + '#type' => 'checkbox', + '#title' => t('Users canot change password'), + '#default_value' => variable_get('cas_hide_password', 0), + '#description' => t('Hides password field on the edit user form') + ); $form['account']['cas_auto_assigned_role'] = array( '#type' => 'select', '#title' => t('Auto-assign users to the role(s)'), @@ -239,13 +306,52 @@ function cas_admin_settings() { '#description' => t('This value can be used to establish a role automatically for all CAS users. If you are also using the simple_ldap module, you can use this role to establish a tie between CAS and LDAP-populated data. i.e. Users with the role of \'cas:user\' should have their LDAP data updated automatically.') ); - $form['pages'] = array('#type' => 'fieldset', '#title' => t('Redirection settings'),'#collapsible' => true, '#collapsed' => true); - $form['pages']['cas_access'] = array('#type' => 'radios', '#title' => t('Require Cas Login for '), '#default_value' => variable_get('cas_access',0), '#options' => array(t('specific pages'), t('all pages'))); - $form['pages']['cas_pages'] = array('#type' => 'textarea', '#title' => t('Specific pages'), '#default_value' => variable_get('cas_pages',''), '#cols' => 40, '#rows' => 5, '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are 'blog' for the blog page and 'blog/*' for every personal blog. '<front>' is the front page.")); - $form['ldap'] = array('#type' => 'fieldset', '#title' => t('LDAP settings'),'#collapsible' => true, '#collapsed' => true); - $form['ldap']['cas_useldap'] = array('#type' => 'checkbox', '#title' => t('Should we extract the user email from an LDAP directory?'), '#default_value' => variable_get('cas_useldap', 0), '#description' => t('Activate this option if you want to extract the user email from an LDAP directory. Ldapauth module must be enabled and configured.')); - $form['ldap']['cas_ldap_email_attribute'] = array('#type' => 'textfield', '#title' => t('Email attribute'), '#default_value' => variable_get('cas_ldap_email_attribute', 'mail'), '#size' => 30,'#maxlength' => 55, '#description' => t('LDAP entry attribute containing the email address.')); - $form['ldap']['cas_useldap_groups'] = array('#type' => 'checkbox', '#title' => t('Should we extract user groups from an LDAP directory?'), '#default_value' => variable_get('cas_useldap_groups', 0), '#description' => t('Activate this option if you want to extract the user groups from an LDAP directory. Ldapgroups module must be enabled and configured.')); + $form['pages'] = array( + '#type' => 'fieldset', + '#title' => t('Redirection settings'), + '#collapsible' => true, + '#collapsed' => true + ); + $form['pages']['cas_access'] = array( + '#type' => 'radios', + '#title' => t('Require Cas Login for '), + '#default_value' => variable_get('cas_access',0), + '#options' => array(t('specific pages'), t('all pages')) + ); + $form['pages']['cas_pages'] = array( + '#type' => 'textarea', + '#title' => t('Specific pages'), + '#default_value' => variable_get('cas_pages',''), + '#cols' => 40, + '#rows' => 5, + '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are 'blog' for the blog page and 'blog/*' for every personal blog. '<front>' is the front page.") + ); + $form['ldap'] = array( + '#type' => 'fieldset', + '#title' => t('LDAP settings'), + '#collapsible' => true, + '#collapsed' => true + ); + $form['ldap']['cas_useldap'] = array( + '#type' => 'checkbox', + '#title' => t('Should we extract the user email from an LDAP directory?'), + '#default_value' => variable_get('cas_useldap', 0), + '#description' => t('Activate this option if you want to extract the user email from an LDAP directory. Ldapauth module must be enabled and configured.') + ); + $form['ldap']['cas_ldap_email_attribute'] = array( + '#type' => 'textfield', + '#title' => t('Email attribute'), + '#default_value' => variable_get('cas_ldap_email_attribute', 'mail'), + '#size' => 30,'#maxlength' => 55, + '#description' => t('LDAP entry attribute containing the email address.') + ); + $form['ldap']['cas_useldap_groups'] = array( + '#type' => 'checkbox', + '#title' => t('Should we extract user groups from an LDAP directory?'), + '#default_value' => variable_get('cas_useldap_groups', 0), + '#description' => t('Activate this option if you want to extract the user groups from an LDAP directory. Ldapgroups module must be enabled and configured.') + ); + return system_settings_form($form); } /** @@ -285,7 +391,7 @@ function cas_login_page() { } drupal_goto($destination); // this should never happen. - $output.= "Cas page... you should never get here"; + $output.= t("Cas page... you should never get here"); drupal_set_message('hi'); return $output; }