Index: openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl,v diff -u -r1.46 -r1.47 --- openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 1 Oct 2003 08:54:06 -0000 1.46 +++ openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 2 Oct 2003 14:22:14 -0000 1.47 @@ -400,52 +400,54 @@ set user_info($elm) [set $elm] } } - array set creation_info [auth::create_local_account \ - -user_id $user_id \ - -authority_id $authority_id \ - -username $username \ - -array user_info] - # Returns: - # creation_info(creation_status) - # creation_info(creation_message) - # creation_info(element_messages) - # creation_info(account_status) - # creation_info(account_message) - # creation_info(user_id) + db_transaction { + array set creation_info [auth::create_local_account \ + -user_id $user_id \ + -authority_id $authority_id \ + -username $username \ + -array user_info] - # We don't do any fancy error checking here, because create_local_account is not a service contract - # so we control it 100% + # Returns: + # creation_info(creation_status) + # creation_info(creation_message) + # creation_info(element_messages) + # creation_info(account_status) + # creation_info(account_message) + # creation_info(user_id) - if { ![string equal $creation_info(creation_status) "ok"] } { - # Local account creation error - return [array get creation_info] - } + # We don't do any fancy error checking here, because create_local_account is not a service contract + # so we control it 100% - # Need to find out which username was set - set username $creation_info(username) + if { ![string equal $creation_info(creation_status) "ok"] } { + # Local account creation error + ad_abort_transaction + return + } - # Save the local account information for later - set local_account_status $creation_info(account_status) - set local_account_message $creation_info(account_message) + # Need to find out which username was set + set username $creation_info(username) - # Clear out remote creation_info array for reuse - array set creation_info { - creation_status {} - creation_message {} - element_messages {} - account_status {} - account_message {} - } + # Save the local account information for later + set local_account_status $creation_info(account_status) + set local_account_message $creation_info(account_message) + # Clear out remote creation_info array for reuse + array set creation_info { + creation_status {} + creation_message {} + element_messages {} + account_status {} + account_message {} + } - ##### - # - # Create remote account - # - ##### - with_catch errmsg { + ##### + # + # Create remote account + # + ##### + array set creation_info [auth::registration::Register \ -authority_id $authority_id \ -username $username \ @@ -457,68 +459,71 @@ -url $url \ -secret_question $secret_question \ -secret_answer $secret_answer] - } { - set auth_info(auth_status) failed_to_connect - set auth_info(auth_message) $errmsg - global errorInfo - ns_log Error "Error invoking account registration driver for authority_id = $authority_id: $errorInfo" - } - - - # Returns: - # creation_info(creation_status) - # creation_info(creation_message) - # creation_info(element_messages) - # creation_info(account_status) - # creation_info(account_message) + + # Returns: + # creation_info(creation_status) + # creation_info(creation_message) + # creation_info(element_messages) + # creation_info(account_status) + # creation_info(account_message) - # Verify creation_info/creation_message return codes - array set default_creation_message { - data_error {Problem with user data} - reg_error {Unknown registration error} - failed_to_connect {Error communicating with account server} - } - - switch $creation_info(creation_status) { - ok { - # Continue below + # Verify creation_info/creation_message return codes + array set default_creation_message { + data_error {Problem with user data} + reg_error {Unknown registration error} + failed_to_connect {Error communicating with account server} } - data_error - - reg_error - - failed_to_connect { - if { ![exists_and_not_null creation_info(creation_message)] } { - set creation_info(creation_message) $default_creation_message($creation_info(creation_status)) + + switch $creation_info(creation_status) { + ok { + # Continue below } - if { ![info exists creation_info(element_messages)] } { - set creation_info(element_messages) {} + data_error - + reg_error - + failed_to_connect { + if { ![exists_and_not_null creation_info(creation_message)] } { + set creation_info(creation_message) $default_creation_message($creation_info(creation_status)) + } + if { ![info exists creation_info(element_messages)] } { + set creation_info(element_messages) {} + } + return [array get creation_info] } - return [array get creation_info] + default { + set creation_info(creation_status) "failed_to_connect" + set creation_info(creation_message) "Illegal error code returned from account creation driver" + return [array get creation_info] + } } - default { - set creation_info(creation_status) "failed_to_connect" - set creation_info(creation_message) "Illegal error code returned from account creation driver" - return [array get creation_info] - } - } - # Verify remote account_info/account_message return codes - switch $creation_info(account_status) { - ok { - # Continue below - set creation_info(account_message) {} - } - closed { - if { ![exists_and_not_null creation_info(account_message)] } { - set creation_info(account_message) "This account is not available at this time" + # Verify remote account_info/account_message return codes + switch $creation_info(account_status) { + ok { + # Continue below + set creation_info(account_message) {} } + closed { + if { ![exists_and_not_null creation_info(account_message)] } { + set creation_info(account_message) "This account is not available at this time" + } + } + default { + set creation_info(account_status) "closed" + set creation_info(account_message) "Illegal error code returned from creationentication driver" + } } - default { - set creation_info(account_status) "closed" - set creation_info(account_message) "Illegal error code returned from creationentication driver" - } + + } on_error { + set creation_info(creation_status) failed_to_connect + set creation_info(creation_message) $errmsg + global errorInfo + ns_log Error "Error invoking account registration driver for authority_id = $authority_id: $errorInfo" + db_abort_transaction } - + if { ![string equal $creation_info(creation_status) "ok"] } { + return [array get creation_info] + } ##### # Index: openacs-4/packages/acs-authentication/tcl/driver-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/driver-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-authentication/tcl/driver-procs.tcl 17 Sep 2003 12:02:09 -0000 1.5 +++ openacs-4/packages/acs-authentication/tcl/driver-procs.tcl 2 Oct 2003 14:22:14 -0000 1.6 @@ -25,13 +25,21 @@ @author Simon Carstensen (simon@collaboraid.biz) @creation-date 2003-08-27 } { + if { [empty_string_p $impl_id] } { + return {} + } + set parameters {} + with_catch errmsg { set parameters [acs_sc::invoke \ -error \ -impl_id $impl_id \ -operation GetParameters] - } {} + } { + global errorInfo + ns_log Error "Error getting parameters for impl_id $impl_id: $errmsg\n$errorInfo" + } return $parameters } Index: openacs-4/packages/acs-authentication/tcl/local-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/local-procs.tcl,v diff -u -r1.22 -r1.23 --- openacs-4/packages/acs-authentication/tcl/local-procs.tcl 2 Oct 2003 09:46:14 -0000 1.22 +++ openacs-4/packages/acs-authentication/tcl/local-procs.tcl 2 Oct 2003 14:22:14 -0000 1.23 @@ -361,7 +361,7 @@ ad_proc -private auth::local::registration::GetElements { {parameters ""} } { - Implements the GetElements operation of the auth_register + Implements the GetElements operation of the auth_registration service contract for the local account implementation. } { set result(required) {} @@ -397,7 +397,7 @@ secret_question secret_answer } { - Implements the Register operation of the auth_register + Implements the Register operation of the auth_registration service contract for the local account implementation. } { array set result { @@ -411,6 +411,7 @@ # We don't create anything here, so creation always succeeds # And we don't check local account, either + # LARS TODO: Move this out of the local driver and into the auth framework # Generate random password? set generated_pwd_p 0 if { [empty_string_p $password] || [parameter::get -package_id [ad_conn subsite_id] -parameter RegistrationProvidesRandomPasswordP -default 0] } { @@ -426,6 +427,7 @@ set system_name [ad_system_name] set system_url [ad_url] + # LARS TODO: Move this out of the local driver and into the auth framework # Send password confirmation email to user if { $generated_pwd_p || \ [parameter::get -parameter RegistrationProvidesRandomPasswordP -package_id [ad_conn subsite_id] -default 0] || \ @@ -446,6 +448,7 @@ } } + # LARS TODO: Move this out of the local driver and into the auth framework # Notify admin on new registration if { [ad_parameter NotifyAdminOfNewRegistrationsP "security" 0] } { with_catch errmsg {