| 1 |
<?php |
<?php |
| 2 |
// $Id: webserver_auth.module,v 1.16 2006/03/25 06:01:54 weitzman Exp $ |
// $Id: webserver_auth.module,v 1.17 2007/04/24 01:09:26 weitzman Exp $ |
| 3 |
|
|
| 4 |
function webserver_auth_init() { |
function webserver_auth_init() { |
| 5 |
global $user, $account; |
global $user, $account; |
| 25 |
} |
} |
| 26 |
|
|
| 27 |
// try to log into Drupal. if unsuccessful, register the user |
// try to log into Drupal. if unsuccessful, register the user |
| 28 |
$user = user_external_load($account->name); |
$test_user = user_external_load($account->name); |
| 29 |
if (!$user->uid) { |
if (!$test_user->uid) { |
| 30 |
if (variable_get("user_register", 1) == 1) { |
if (variable_get("user_register", 1) == 1) { |
| 31 |
$user_default = array("name" => $account->name, "pass" => "cyan", "init" => db_escape_string($name), "authname_webserver_auth" => $account->name, "status" => 1, "roles" => array(DRUPAL_AUTHENTICATED_RID)); |
$user_default = array("name" => $account->name, "pass" => "cyan", "init" => db_escape_string($name), "authname_webserver_auth" => $account->name, "status" => 1, "roles" => array(DRUPAL_AUTHENTICATED_RID)); |
| 32 |
// TODO - the hook_user('register') will fire but only for loaded modules. could be a problem for sites using page cache and that hook+operation |
// TODO - the hook_user('register') will fire but only for loaded modules. could be a problem for sites using page cache and that hook+operation |
| 34 |
watchdog("user", "new user: $user->name (webserver_auth)", l(t("edit user"), "admin/user/edit/$user->uid")); |
watchdog("user", "new user: $user->name (webserver_auth)", l(t("edit user"), "admin/user/edit/$user->uid")); |
| 35 |
} |
} |
| 36 |
} |
} |
| 37 |
|
else{ |
| 38 |
|
$user = $test_user; |
| 39 |
|
} |
| 40 |
} |
} |
| 41 |
else { |
else { |
| 42 |
// do nothing. user isn't logged into web server |
// do nothing. user isn't logged into web server |