user_external_load fails for most existing users due to http://drupal.org/node/13619. Can we patch:

      // try to log into Drupal. if unsuccessful, register the user
	  $test_user = user_external_load($account->name);

	  // ADD Search user_load instead of user_external_load
	  if(!test_user) {
      $test_user = user_load(array("name" => $account->name));
	  }
	  //ADD ends
      if (!$test_user->uid) {

Would also be good to select the user variable in the UI as I am using squid to present the user on on a unix box from an NT network. (php_auth_user) - think this would be a good addition for intranets as most companies can't get support for mod_ntlm from their vendour

Comments

DRScales’s picture

sorry - that had no $

$test_user = user_external_load($account->name);

	  // added
	  if(!$test_user->uid) {
      $test_user = user_load(array("name" => $account->name));
	  }
DRScales’s picture

and as for the UI - something akin to

function webserver_auth_init() {
  global $user, $account;

  $remote_user = "";
  
   // CookedBreakfast server variable changed to our squid variable 'php_auth_user' this can be changed in the UI
   $uservar = variable_get("webserver_auth_uservar", "");

  if (isset($_SERVER["$uservar"])) {
     $remote_user = $_SERVER["$uservar"];
	 // ends
  }

with the form addition

function webserver_auth_settings() {
  $form["webserver_auth_domain"] = array(
    '#type' => 'textfield',
    '#title' => t("Email Domain"),
    '#default_value' => variable_get("webserver_auth_domain", ""),
    '#size' => 30,
    '#maxlength' => 55,
    '#description' => t("Append this domain name to each new user in order generate his email address. Currently only used for NTLM authentication."),
    );
	$form["webserver_auth_uservar"] = array(
    '#type' => 'textfield',
    '#title' => t("User Variable"),
    '#default_value' => variable_get("webserver_auth_uservar", ""),
    '#size' => 30,
    '#maxlength' => 55,
    '#description' => t("The name of your environment user variable"),
    );
  return system_settings_form($form);	
}
gaards’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closed because Drupal 5 is not supported. If the issue verifiably applies to later versions, please reopen with details and update the version.