Index: openacs-4/packages/acs-authentication/acs-authentication.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/acs-authentication.info,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/acs-authentication/acs-authentication.info 24 Oct 2003 13:29:04 -0000 1.6 +++ openacs-4/packages/acs-authentication/acs-authentication.info 24 Oct 2003 16:44:19 -0000 1.7 @@ -7,19 +7,20 @@ t t - + Lars Pind Authentication and related functionality. Collaboraid Implements authentication-related security functions for OpenACS, including authentication, password maangement, account management, session management, etc. - + + Index: openacs-4/packages/acs-authentication/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/apm-callback-procs.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/acs-authentication/tcl/apm-callback-procs.tcl 8 Oct 2003 09:59:06 -0000 1.10 +++ openacs-4/packages/acs-authentication/tcl/apm-callback-procs.tcl 24 Oct 2003 16:44:19 -0000 1.11 @@ -60,7 +60,53 @@ } } +ad_proc -public auth::after_upgrade { + {-from_version_name:required} + {-to_version_name:required} +} { + apm_upgrade_logic \ + -from_version_name $from_version_name \ + -to_version_name $to_version_name \ + -spec { + 5.0a1 5.0a2 { + db_transaction { + + # Delete and recreate contract + auth::process_doc::delete_contract + auth::process_doc::create_contract + # The old implementation is still there, but now it's unbound + + # We change the name of the old implementation, so we can recreate it, but don't break foreign key references to it + set old_impl_id [acs_sc::impl::get_id -name "IMS_Enterprise_v_1p1" -owner "acs-authentication"] + db_dml update { + update acs_sc_impls + set impl_name = 'IMS_Enterprise_v_1p1_old' + where impl_id = :old_impl_id + } + db_dml update { + update acs_sc_impl_aliases + set impl_name = 'IMS_Enterprise_v_1p1_old' + where impl_id = :old_impl_id + } + + # Create the new implementation + set new_impl_id [auth::sync::process_doc::ims::register_impl] + + # Update authorities that used to use the old impl to use the new impl + db_dml update_authorities { + update auth_authorities + set process_doc_impl_id = :new_impl_id + where process_doc_impl_id = :old_impl_id + } + + # Delete the old implementation + acs_sc::impl::delete -contract_name "auth_sync_process" -impl_name "IMS_Enterprise_v_1p1_old" + } + } + } +} + ##### # # auth_authentication service contract @@ -388,6 +434,16 @@ parameters:string,multiple } } + GetAcknowledgementDocument { + description { + Return an acknowledgement document in a format suitable for display on. + } + input { + job_id:integer + document:string + parameters:string,multiple + } + } GetElements { description { Get an list of the elements handled by this batch synchronization Index: openacs-4/packages/acs-authentication/tcl/authority-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/authority-procs.tcl,v diff -u -N -r1.18 -r1.19 --- openacs-4/packages/acs-authentication/tcl/authority-procs.tcl 24 Oct 2003 13:28:44 -0000 1.18 +++ openacs-4/packages/acs-authentication/tcl/authority-procs.tcl 24 Oct 2003 16:44:19 -0000 1.19 @@ -341,6 +341,15 @@ -authority_id $authority_id \ -job_id $job_id \ -document $doc_result(document) + + set ack_doc [auth::sync::GetAcknowledgementDocument \ + -authority_id $authority_id \ + -job_id $job_id \ + -document $doc_result(document)] + + template::util::write_file \ + "[acs_root_dir]/batch-sync-acknolwedgement.xml" \ + $ack_doc } { global errorInfo ns_log Error "Error processing sync document:\n$errorInfo" Index: openacs-4/packages/acs-authentication/tcl/sync-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/sync-procs.tcl,v diff -u -N -r1.24 -r1.25 --- openacs-4/packages/acs-authentication/tcl/sync-procs.tcl 24 Oct 2003 13:29:04 -0000 1.24 +++ openacs-4/packages/acs-authentication/tcl/sync-procs.tcl 24 Oct 2003 16:44:19 -0000 1.25 @@ -37,7 +37,6 @@ db_1row select_job {} -column_array row - # TODO: This is temporary, make sure this is where the UI ends up set row(log_url) [export_vars -base "[ad_url]/acs-admin/auth/batch-job" { job_id }] } @@ -580,6 +579,33 @@ -call_args [list $job_id $document $parameters]] } +ad_proc -private auth::sync::GetAcknowledgementDocument { + {-authority_id:required} + {-job_id:required} + {-document:required} +} { + Wrapper for the GetAckDocument operation of the auth_sync_process service contract. +} { + set impl_id [auth::authority::get_element -authority_id $authority_id -element "process_doc_impl_id"] + + if { [empty_string_p $impl_id] } { + # No implementation of auth_sync_process + set authority_pretty_name [auth::authority::get_element -authority_id $authority_id -element "pretty_name"] + error "The authority '$authority_pretty_name' doesn't support auth_sync_process" + } + + set parameters [auth::driver::get_parameter_values \ + -authority_id $authority_id \ + -impl_id $impl_id] + + return [acs_sc::invoke \ + -error \ + -contract "auth_sync_process" \ + -impl_id $impl_id \ + -operation GetAcknowledgementDocument \ + -call_args [list $job_id $document $parameters]] +} + ad_proc -private auth::sync::GetElements { {-authority_id:required} } { @@ -702,6 +728,7 @@ pretty_name "IMS Enterprise 1.1" aliases { ProcessDocument auth::sync::process_doc::ims::ProcessDocument + GetAcknowledgementDocument auth::sync::process_doc::ims::GetAcknowledgementDocument GetElements auth::sync::process_doc::ims::GetElements GetParameters auth::sync::process_doc::ims::GetParameters } @@ -791,3 +818,57 @@ -array user_info } } + + +ad_proc -public auth::sync::process_doc::ims::GetAcknowledgementDocument { + job_id + document + parameters +} { + Generates an record-wise acknolwedgement document in home-brewed + adaptation of the IMS Enterprise v 1.1 spec. +} { + set tree [xml_parse -persist $document] + set root_node [xml_doc_get_first_node $tree] + if { ![string equal [xml_node_get_name $root_node] "enterprise"] } { + error "Root node was not " + } + + set timestamp [xml_get_child_node_content_by_path $root_node { { properties datetime } }] + + append doc {} \n + append doc {} \n + append doc { } \n + append doc { acknowledgement} \n + append doc { } $timestamp {} \n + append doc { } \n + + array set recstatus { + insert 1 + update 2 + delete 3 + } + + # Loop over successful actions + db_foreach select_success_actions { + select entry_id, + operation, + username + from auth_batch_job_entries + where job_id = :job_id + and success_p = 't' + order by entry_id + } { + if { [info exists recstatus($operation)] } { + append doc { } \n + append doc { OpenACS} $username {} \n + append doc { } \n + } else { + ns_log Error "Illegal operation encountered in job action log: '$operation'. Entry_id is '$entry_id'." + } + } + + append doc {} \n + + return $doc +}