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.2 -r1.3 --- openacs-4/packages/acs-authentication/tcl/driver-procs.tcl 29 Aug 2003 15:22:21 -0000 1.2 +++ openacs-4/packages/acs-authentication/tcl/driver-procs.tcl 3 Sep 2003 19:45:32 -0000 1.3 @@ -25,55 +25,37 @@ @author Simon Carstensen (simon@collaboraid.biz) @creation-date 2003-08-27 } { - # Find the contract_name and impl_name - db_1row select_contract_impl_name { - select impl_name as impl, - impl_contract_name as contract - from acs_sc_impls - where impl_id = :impl_id - } - - # Check that it's a contract that we know of, or that it has the GetParameters method - set method_exists_p [db_string select_getparameters_method { - select 1 - from acs_sc_impl_aliases - where impl_id = :impl_id - and impl_operation_name = 'GetParameters' - } -default "0"] - - if { $method_exists_p } { - # call GetParameters on the impl and return that - return [acs_sc::invoke \ - -contract $contract \ - -impl $impl \ - -operation GetParameters] - } else { - # GetParameters method doesn't exist, throw an aa error - aa_true "Does the GetParameter exist?" 0 - } + return [acs_sc::invoke \ + -error \ + -impl_id $impl_id \ + -operation GetParameters] } ad_proc -public auth::driver::get_parameter_values { - {-impl_id:required} {-authority_id:required} + {-impl_id:required} } { Gets a list of parameter values ready to be passed to a service contract implementation. If a parameter doesn't have a value, the value will be the empty string. @author Simon Carstensen (simon@collaboraid.biz) @creation-date 2003-08-27 } { - return [db_list select_values { - select value + set params [list] + db_foreach select_values { + select key, value from auth_driver_params where impl_id = :impl_id and authority_id = :authority_id - }] + } { + lappend params $key $value + } + return $params } ad_proc -public auth::driver::set_parameter_value { - {-impl_id:required} {-authority_id:required} + {-impl_id:required} {-parameter:required} {-value:required} } { @@ -82,5 +64,11 @@ @author Simon Carstensen (simon@collaboraid.biz) @creation-date 2003-08-27 } { - db_dml set_parameter {} -clobs [list $value] + set exists_p [db_string param_exists_p {}] + + if { $exists_p } { + db_dml update_parameter {} -clobs [list $value] + } else { + db_dml insert_parameter {} -clobs [list $value] + } }