Index: openacs-4/packages/acs-authentication/catalog/acs-authentication.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/catalog/acs-authentication.en_US.ISO-8859-1.xml,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-authentication/catalog/acs-authentication.en_US.ISO-8859-1.xml 18 Nov 2007 21:27:09 -0000 1.9 +++ openacs-4/packages/acs-authentication/catalog/acs-authentication.en_US.ISO-8859-1.xml 8 Sep 2008 20:14:58 -0000 1.10 @@ -1,5 +1,10 @@ + Add to Community + Add to %system_name% + Does not have an account on %system_name% + Has an account on %system_name% Invalid username or password + Not getting the results you expected? Try searching: 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 -r1.16 -r1.17 --- openacs-4/packages/acs-authentication/tcl/apm-callback-procs.tcl 4 Jun 2006 00:45:21 -0000 1.16 +++ openacs-4/packages/acs-authentication/tcl/apm-callback-procs.tcl 8 Sep 2008 20:14:58 -0000 1.17 @@ -13,8 +13,8 @@ namespace eval auth::get_doc {} namespace eval auth::process_doc {} namespace eval auth::user_info {} +namespace eval auth::search {} - ad_proc -private auth::package_install {} {} { db_transaction { @@ -25,6 +25,7 @@ auth::get_doc::create_contract auth::process_doc::create_contract auth::user_info::create_contract + auth::search::create_contract # Register local authentication implementations and update the local authority auth::local::install @@ -63,6 +64,7 @@ auth::get_doc::delete_contract auth::process_doc::delete_contract auth::user_info::delete_contract + auth::search::delete_contract } } @@ -607,3 +609,56 @@ } +##### +# +# auth_search service contract +# +##### + +ad_proc -private auth::search::create_contract {} { + Create service contract for authority searches. +} { + set spec { + name "auth_search" + description "Search users in given authority" + operations { + Search { + description { + Search authority using "search" string. Returns array-list of usernames. + } + input { + search:string + parameters:string,multiple + } + output { + usernames:string,multiple + } + } + GetParameters { + description { + Get an array-list of the parameters required by this service contract implementation. + } + output { + parameters:string,multiple + } + } + FormInclude { + description { + File location of an includable search form + } + output { + form_include:string + } + } + } + } + + acs_sc::contract::new_from_spec -spec $spec +} + + +ad_proc -private auth::search::delete_contract {} { + Delete service contract for authority search. +} { + acs_sc::contract::delete -name "auth_search" +} 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.80 -r1.81 --- openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 8 Sep 2008 20:00:10 -0000 1.80 +++ openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 8 Sep 2008 20:14:58 -0000 1.81 @@ -861,7 +861,7 @@ set user_info($elm) {} } } - + # Validate data auth::validate_account_info \ -authority_id $authority_id \ @@ -1225,14 +1225,13 @@ if { $authority_id eq "" } { set authority_id [auth::authority::local] } - + ns_log notice "auth::get_local_account authority_id = '${authority_id}' local = [auth::authority::local]" with_catch errmsg { acs_user::get -authority_id $authority_id -username $username -array user set account_found_p 1 } { set account_found_p 0 } - if { !$account_found_p } { # Try for an on-demand sync @@ -1460,19 +1459,21 @@ if { !$update_p } { set required_elms [concat $required_elms { first_names last_name email }] } + foreach elm $required_elms { if { ![exists_and_not_null user($elm)] } { set element_messages($elm) "Required" } } if { [info exists user(email)] } { - set user(email) [string trim $user(email)] + set user(email) [string trim $user(email)] } + if { [info exists user(username)] } { - set user(username) [string trim $user(username)] + set user(username) [string trim $user(username)] } - + if { $update_p } { set user(user_id) [acs_user::get_by_username \ -authority_id $authority_id \ 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 -r1.26 -r1.27 --- openacs-4/packages/acs-authentication/tcl/authority-procs.tcl 10 Jan 2007 21:22:01 -0000 1.26 +++ openacs-4/packages/acs-authentication/tcl/authority-procs.tcl 8 Sep 2008 20:14:58 -0000 1.27 @@ -449,9 +449,11 @@ register_impl_id "" register_url "" user_info_impl_id "" + search_impl_id "" get_doc_impl_id "" process_doc_impl_id "" batch_sync_enabled_p "f" + allow_user_entered_info_p "f" } } @@ -473,15 +475,15 @@ @author Peter Marklund } { - return {auth_impl_id pwd_impl_id register_impl_id user_info_impl_id get_doc_impl_id process_doc_impl_id} + return {auth_impl_id pwd_impl_id register_impl_id user_info_impl_id search_impl_id get_doc_impl_id process_doc_impl_id} } ad_proc -private auth::authority::get_select_columns {} { Get a list of the columns which can be selected from auth_authorities table. @author Lars Pind (lars@collaboraid.biz) } { - return [concat [get_columns] auth_impl_name pwd_impl_name register_impl_name user_info_impl_name get_doc_impl_name process_doc_impl_name] + return [concat [get_columns] auth_impl_name pwd_impl_name register_impl_name user_info_impl_name get_search_impl_name get_doc_impl_name process_doc_impl_name] } @@ -512,6 +514,7 @@ lappend columns "(select impl_pretty_name from acs_sc_impls where impl_id = pwd_impl_id) as pwd_impl_name" lappend columns "(select impl_pretty_name from acs_sc_impls where impl_id = register_impl_id) as register_impl_name" lappend columns "(select impl_pretty_name from acs_sc_impls where impl_id = user_info_impl_id) as user_info_impl_name" + lappend columns "(select impl_pretty_name from acs_sc_impls where impl_id = search_impl_id) as search_impl_name" lappend columns "(select impl_pretty_name from acs_sc_impls where impl_id = get_doc_impl_id) as get_doc_impl_name" lappend columns "(select impl_pretty_name from acs_sc_impls where impl_id = process_doc_impl_id) as process_doc_impl_name" 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.33 -r1.34 --- openacs-4/packages/acs-authentication/tcl/local-procs.tcl 25 Sep 2007 15:22:34 -0000 1.33 +++ openacs-4/packages/acs-authentication/tcl/local-procs.tcl 8 Sep 2008 20:14:58 -0000 1.34 @@ -11,9 +11,9 @@ namespace eval auth::local::authentication {} namespace eval auth::local::password {} namespace eval auth::local::registration {} +namespace eval auth::local::user_info {} +namespace eval auth::local::search {} - - ##### # # auth::local @@ -29,7 +29,9 @@ set row(auth_impl_id) [auth::local::authentication::register_impl] set row(pwd_impl_id) [auth::local::password::register_impl] set row(register_impl_id) [auth::local::registration::register_impl] - + set row(search_impl_id) [auth::local::search::register_impl] + set row(user_info_impl_id) [auth::local::user_info::register_impl] + # Set the authority pretty-name to be the system name set row(pretty_name) [ad_system_name] @@ -553,3 +555,111 @@ # No parameters return [list] } + +##### +# +# The 'auth_user_info' service contract implementation +# + +ad_proc -private auth::local::user_info::register_impl {} { + Register the 'local' implementation of the 'auth_user_info' service contract. + + @return impl_id of the newly created implementation. +} { + set spec { + contract_name "auth_user_info" + owner "acs-authentication" + name "local" + pretty_name "Local" + aliases { + GetUserInfo auth::local::user_info::GetUserInfo + GetParameters auth::local::user_info::GetParameters + } + } + return [acs_sc::impl::new_from_spec -spec $spec] +} + +ad_proc -private auth::local::user_info::unregister_impl {} { + Unregister the 'local' implementation of the 'auth_user_info' service contract. +} { + acs_sc::impl::delete -contract_name "auth_user_info" -impl_name "local" +} + +ad_proc -private auth::local::user_info::GetUserInfo { + user_id + {parameters ""} +} { + Implements the GetUserInfo operation of the auth_user_info + service contract for the local account implementation. +} { + + set result(info_status) [auth::get_local_account_status -user_id $user_id] + set result(info_message) "" + db_1row get_user_info {} -column_array user_info + set result(user_info) [array get user_info] + + return [array get result] +} + +ad_proc -private auth::local::user_info::GetParameters {} { + Implements the GetParameters operation of the auth_user_info + service contract for the local account implementation. +} { + # No parameters + return [list] +} + +##### +# +# The 'auth_search' service contract implementation +# + +ad_proc -private auth::local::search::register_impl {} { + Register the 'local' implementation of the 'auth_search' service contract. Returns + a list of user_ids suitable for user with the 'local' 'user_info' implementation. + + @return impl_id of the newly created implementation. +} { + set spec { + contract_name "auth_search" + owner "acs-authentication" + name "local" + pretty_name "Local" + aliases { + Search auth::local::search::Search + GetParameters auth::local::search::GetParameters + } + } + return [acs_sc::impl::new_from_spec -spec $spec] +} + +ad_proc -private auth::local::search::unregister_impl {} { + Unregister the 'local' implementation of the 'auth_search' service contract. +} { + acs_sc::impl::delete -contract_name "auth_search" -impl_name "local" +} + +ad_proc -private auth::local::search::Search { + search_text + {parameters ""} +} { + Implements the Search operation of the auth_search + service contract for the local account implementation. +} { + + set results [list] + db_foreach user_search {} { + lappend results $user_id + } + + return $results + +} + +ad_proc -private auth::local::search::GetParameters {} { + Implements the GetParameters operation of the auth_search + service contract for the local account implementation. +} { + # No parameters + return [list] +} Index: openacs-4/packages/acs-authentication/tcl/local-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/local-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-authentication/tcl/local-procs.xql 4 Jun 2006 00:45:21 -0000 1.2 +++ openacs-4/packages/acs-authentication/tcl/local-procs.xql 8 Sep 2008 20:14:58 -0000 1.3 @@ -8,6 +8,28 @@ + + + select distinct user_id, username, email + from cc_users u + where upper(coalesce(u.first_names || ' ', '') || + coalesce(u.last_name || ' ', '') || + u.email || ' ' || + u.username || ' ' || + coalesce(u.screen_name, '')) like upper('%'||:search_text||'%') + order by username, email + + + + + + + select user_id, first_names, last_name, username, email + from cc_users + where user_id = :user_id + + +