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 -N -r1.2 -r1.3 --- openacs-4/packages/ims-ent/tcl/dotlrn-procs.tcl 13 Jul 2004 01:12:41 -0000 1.2 +++ openacs-4/packages/ims-ent/tcl/dotlrn-procs.tcl 21 Jul 2004 18:18:29 -0000 1.3 @@ -14,6 +14,48 @@ namespace eval ims_enterprise::dotlrn {} + +#----------------------ug-local-automatic------------- + + +ad_proc -private ims_enterprise::dotlrn::register { + {-ims_id:required} + {-authority_id:required} +} { + + set impl_id [auth::authority::get_element -authority_id $authority_id -element "auth_impl_id"] + + if { [empty_string_p $impl_id] } { + # No implementation of authentication + set authority_pretty_name [auth::authority::get_element -authority_id $authority_id -element "pretty_name"] + error "The authority '$authority_pretty_name' doesn't support authentication" + } + + set parameters [auth::driver::get_parameter_values \ + -authority_id $authority_id \ + -impl_id $impl_id] + + set userPassword [auth::ldap::get_user -username $username -parameters $parameters -element "userPassword"] + lappend parameters InfoAttributeMap "first_names=givenName;last_name=sn;email=mail;field_name=userClass" + array set info_result [auth::local_ldap::user_info::GetUserInfo $username $parameters] + + array set user_info $info_result(user_info) + set user_id [ad_user_new $user_info(email) \ + $user_info(first_names) $user_info(last_name) \ + $password {} {} {} 1 "approved" {} $username $authority_id $username] + + # Also, register the carnet (username) only for this very first + # time (roc) !!!!!!! + + db_dml register_id { insert into user_id_member_field_map (user_id, field_name, field_value) values (:user_id, :user_info(field_name), :username) } + + db_dml update_passwd { update users set password = :userPassword, salt = '' where user_id = :user_id } + +} + +#-------------------------------------- + + ad_proc -private ims_enterprise::dotlrn::get_user_id { {-ims_id:required} {-authority_id:required} @@ -32,7 +74,7 @@ @error } { - return +# return set user_id [db_string get_user_id { select user_id from user_id_member_field_map where field_value = :ims_id @@ -41,8 +83,10 @@ if [empty_string_p $user_id] { # try to authenticate this user (search on ldap & register locally) - auth::authentication::Authenticate -authority_id $authority_id -username $ims_id -password $ims_id + ims_enterprise::dotlrn::register -ims_id $ims_id -authority_id $authority_id +# auth::authentication::Authenticate -authority_id $authority_id -username $ims_id -password $ims_id + set user_id [db_string get_user_id { select user_id from user_id_member_field_map where field_value = :ims_id } -default "" ] @@ -77,3 +121,4 @@ 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 -N -r1.3 -r1.4 --- openacs-4/packages/ims-ent/tcl/ims-ent-dotlrn-procs.tcl 2 Jul 2004 20:35:37 -0000 1.3 +++ openacs-4/packages/ims-ent/tcl/ims-ent-dotlrn-procs.tcl 21 Jul 2004 18:18:29 -0000 1.4 @@ -602,6 +602,8 @@ element_messages {} } + set user_id "" + # if the community_id doesn't exist, then its an error if [empty_string_p $community_id] { set success_p 0 @@ -613,8 +615,10 @@ 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] + set proc_list [list [lindex ${proc_name} 0] [lindex ${proc_name} 1] $id -authority_id $authority_id] + set user_id [eval $proc_list] + if { [empty_string_p $user_id] } { # Updating/deleting a user that doesn't exist set success_p 0 @@ -653,7 +657,7 @@ 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 +# ims_enterprise::dotlrn::set_carnet_type -carnet $id -roletype $roletype } set result(message) "" } { @@ -678,4 +682,6 @@ -element_messages $result(element_messages)] } + + return $user_id } 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 -N -r1.5 -r1.6 --- openacs-4/packages/ims-ent/tcl/ims-ent-parser-procs.tcl 2 Jul 2004 20:35:37 -0000 1.5 +++ openacs-4/packages/ims-ent/tcl/ims-ent-parser-procs.tcl 21 Jul 2004 18:18:29 -0000 1.6 @@ -270,18 +270,17 @@ set operation [ims_enterprise::ims_dotlrn::recstatus -recstatus $recstatus] + set user_id [ims_enterprise::ims_dotlrn::membership::membership \ + -job_id $job_id \ + -class_instance_key $class_instance_key \ + -community_id $community_id \ + -id $id \ + -authority_id $authority_id \ + -roletype $roletype \ + -operation $operation] - ims_enterprise::ims_dotlrn::membership::membership \ - -job_id $job_id \ - -class_instance_key $class_instance_key \ - -community_id $community_id \ - -id $id \ - -authority_id $authority_id \ - -roletype $roletype \ - -operation $operation + lappend member_list $user_id - lappend member_list $id - } if {$operation == "snapshot"} {