Index: openacs-4/packages/ims-ent/ims-ent.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ims-ent/ims-ent.info,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ims-ent/ims-ent.info 11 Jun 2004 22:00:34 -0000 1.3 +++ openacs-4/packages/ims-ent/ims-ent.info 11 Jun 2004 23:02:21 -0000 1.4 @@ -18,9 +18,11 @@ + + Index: openacs-4/packages/ims-ent/tcl/apm-callbacks-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ims-ent/tcl/apm-callbacks-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ims-ent/tcl/apm-callbacks-procs.tcl 10 Jun 2004 17:29:46 -0000 1.2 +++ openacs-4/packages/ims-ent/tcl/apm-callbacks-procs.tcl 11 Jun 2004 23:02:21 -0000 1.3 @@ -10,7 +10,9 @@ @cvs-id $Id$ } +namespace eval ims_enterprise {} namespace eval ims_enterprise::apm_callback {} +namespace eval ims_enterprise::get_doc::xml_rpc {} ad_proc -private ims_enterprise::apm_callback::package_install { } { @@ -27,11 +29,35 @@ db_transaction { ims_enterprise::unregister_impl ims_enterprise::register_impl + + ims_enterprise::get_doc::xml_rpc::register_impl } } +ad_proc -private ims_enterprise::apm_callback::package_uninstall { +} { + this will uninstall existing related SC for ims-ent + + @author Rocael Hernandez (roc@viaro.net) + @creation-date 2004-06-04 + + @return + + @error +} { + + db_transaction { + ims_enterprise::unregister_impl +# ims_enterprise::register_impl + + ims_enterprise::get_doc::xml_rpc::unregister_impl + } + +} + + ad_proc -private ims_enterprise::register_impl {} { Register this implementation } { @@ -57,3 +83,27 @@ } { acs_sc::impl::delete -contract_name "auth_sync_process" -impl_name "IMS_Enterprise_v_1p1" } + +ad_proc -private ims_enterprise::get_doc::xml_rpc::register_impl {} { + Register this implementation +} { + set spec { + contract_name "auth_sync_retrieve" + owner "acs-authentication" + name "XMLRPC" + pretty_name "XML-RPC" + aliases { + GetDocument ims_enterprise::sync::get_doc::xml_rpc::GetDocument + GetParameters ims_enterprise::sync::get_doc::xml_rpc::GetParameters + } + } + + return [acs_sc::impl::new_from_spec -spec $spec] + +} + +ad_proc -private auth::sync::get_doc::xml_rpc::unregister_impl {} { + Unregister this implementation +} { + acs_sc::impl::delete -contract_name "auth_sync_retrieve" -impl_name "XMLRPC" +} Index: openacs-4/packages/ims-ent/tcl/dotlrn-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ims-ent/tcl/dotlrn-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ims-ent/tcl/dotlrn-procs.tcl 11 Jun 2004 23:02:21 -0000 1.1 @@ -0,0 +1,68 @@ +# + +ad_library { + + specific library for Galileo University needs + + @author Rocael Hernandez Rizzardini (roc@viaro.net) + @creation-date 2004-06-10 + @arch-tag: 4331F72E-BB58-11D8-A758-000A95ABB5AA + @cvs-id $Id: dotlrn-procs.tcl,v 1.1 2004/06/11 23:02:21 rocaelh Exp $ +} + + +namespace eval ims_enterprise::dotlrn {} + +ad_proc -private ims_enterprise::dotlrn::get_user_id { + {-ims_id:required} + {-authority_id:required} +} { + get the user_id, that's related to the student_id map table that + is tied to a give user_id + + @author Rocael Hernandez Rizzardini (roc@viaro.net) + @creation-date 2004-06-10 + + @param ims_id + + @param authority_id + + @return + + @error +} { + return + + set user_id [db_string get_user_id { + select user_id from carnets where carnet = :ims_id + } -default "" ] + + return $user_id +} + +ad_proc -private ims_enterprise::dotlrn::set_carnet_type { + {-carnet:required} + {-roletype:required} +} { + This proc will be called among membership proc to update + the info about the type it is a given carnet. + + @author Rocael Hernandez Rizzardini (roc@viaro.net) + @creation-date 2004-06-10 + + @param carnet + + @param roletype + + @return + + @error +} { + + return + + db_dml set_carnet_type { + update carnets set type = :roletype + where carnet = :carnet + } +} Index: openacs-4/packages/ims-ent/tcl/ims-ent-dotlrn-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ims-ent/tcl/ims-ent-dotlrn-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ims-ent/tcl/ims-ent-dotlrn-procs.tcl 9 Jun 2004 18:08:07 -0000 1.1 +++ openacs-4/packages/ims-ent/tcl/ims-ent-dotlrn-procs.tcl 11 Jun 2004 23:02:21 -0000 1.2 @@ -559,11 +559,11 @@ } -ad_proc -private ims_enterprise::ims_dotlrn::groups::membership { +ad_proc -private ims_enterprise::ims_dotlrn::membership::membership { {-job_id:required} {-class_instance_key:required} {-community_id:required} - {-username:required} + {-id:required} {-authority_id:required} {-roletype:required} {-operation:required} @@ -580,7 +580,8 @@ @param community_id - @param username + @param id ID that's is comming at IMS XML doc, which identify a + given user in our system (ins't the user_id, but we'll use it for getting it) @param authority_id @@ -607,28 +608,27 @@ set result(message) ": A class with this class instance key '$class_instance_key' doesn't exist" } else { - # lets get the user_id (we use the username as key for - # getting the user) - # the user should not be able to change the username! or - # we should store that in another place! - # (roc) + # now lets call the proc defined as param, it must + # return the user_id - set user_id [acs_user::get_by_username -authority_id $authority_id -username $username] + set proc_name [parameter::get_from_package_key -package_key ims-ent -parameter UserIdReturnProc] + # execute the proc and get the user_id + set user_id [${proc_name} $id -authority_id $authority_id] if { [empty_string_p $user_id] } { # Updating/deleting a user that doesn't exist set success_p 0 - set result(message) "A user with username '$username' does not exist" + set result(message) "A user with id '$id' does not exist" } else { acs_user::get -user_id $user_id -array existing_user_info if { [string equal $existing_user_info(member_state) "banned"] } { # Updating/deleting a user that's already deleted set success_p 0 - set result(message) "The user with username '$username' has been deleted (banned)" + set result(message) "The user with id '$id' has been deleted (banned)" } elseif ![dotlrn::user_p -user_id $user_id] { # This is not a dotlrn user set success_p 0 - set result(message) ": The user with username '$username' isn't a dotlrn user" + set result(message) ": The user with id '$id' isn't a dotlrn user" } } } @@ -651,6 +651,9 @@ set rel_type [ims_enterprise::ims_dotlrn::membership::rel_type $roletype] dotlrn_community::add_user -rel_type $rel_type $community_id $user_id + + # lets update the given ID type for this user_id + ims_enterprise::dotlrn::set_carnet_type -carnet $id -roletype $roletype } set result(message) "" } { @@ -666,7 +669,7 @@ set entry_id [ims_enterprise::sync::job::create_entry \ -job_id $job_id \ -operation $operation \ - -username $username \ + -username $id \ -user_id $user_id \ -community_key $community_id \ -class_instance_key $class_instance_key \ Index: openacs-4/packages/ims-ent/tcl/ims-ent-parser-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ims-ent/tcl/ims-ent-parser-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ims-ent/tcl/ims-ent-parser-procs.tcl 10 Jun 2004 20:06:36 -0000 1.2 +++ openacs-4/packages/ims-ent/tcl/ims-ent-parser-procs.tcl 11 Jun 2004 23:02:21 -0000 1.3 @@ -276,11 +276,11 @@ set operation [ims_enterprise::ims_dotlrn::recstatus -recstatus $recstatus] - ims_enterprise::ims_dotlrn::groups::membership \ + ims_enterprise::ims_dotlrn::membership::membership \ -job_id $job_id \ -class_instance_key $class_instance_key \ -community_id $community_id \ - -username $id \ + -id $id \ -authority_id $authority_id \ -roletype $roletype \ -operation $operation Index: openacs-4/packages/ims-ent/tcl/xmlrpc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ims-ent/tcl/xmlrpc-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ims-ent/tcl/xmlrpc-procs.tcl 11 Jun 2004 23:02:21 -0000 1.1 @@ -0,0 +1,69 @@ +# + +ad_library { + + for handling the communication via RPC + + @author Rocael Hernandez Rizzardini (roc@viaro.net) + @creation-date 2004-06-10 + @arch-tag: AA9C688E-BB65-11D8-99F6-000A95ABB5AA + @cvs-id $Id: xmlrpc-procs.tcl,v 1.1 2004/06/11 23:02:21 rocaelh Exp $ +} + +namespace eval ims_enterprise::sync::get_doc::xmlrpc::GetDocument {} + +ad_proc -private ims_enterprise::sync::get_doc::xmlrpc::GetParameters {} { + Parameters for HTTP GetDocument implementation. +} { + return { + RPCServerURL {The URL of the xml-rpc server, including where the rpc responds.} + IncrementalProc {The remote procedure name for Incremental IMS XML documents.} + SnapshotProc {The remote procedure name for Snapshot IMS XML documents.} + } +} + +ad_proc -private ims_enterprise::sync::get_doc::xmlrpc::GetDocument { + parameters +} { + Retrieve the document by XML-RPC +} { + array set result { + doc_status failed_to_conntect + doc_message {} + document {} + snapshot_p f + } + + array set param $parameters + + if { (![empty_string_p $param(SnapshotProc)] && [string equal [clock format [clock seconds] -format "%d"] "01"]) || \ + [empty_string_p $param(IncrementalProc)] } { + + # On the first day of the month, we get a snapshot + set proc $param(SnapshotURL) + set result(snapshot_p) "t" + } else { + # All the other days of the month, we get the incremental + set proc $param(IncrementalURL) + } + + set url $param(RPCServerURL) + + if { [empty_string_p $url] } { + error "You must specify the URL of the XML-RPC server." + } + + if { [empty_string_p $proc] } { + error "You must specify at least one remote procedure to call." + } + + + catch {xmlrpc::remote_call $url $proc} result(document) + + # we need to check if the document returned its a valid one! + + set result(doc_status) "ok" + + return [array get result] +} +