Index: openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl,v diff -u -r1.70 -r1.71 --- openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl 9 May 2018 15:33:29 -0000 1.70 +++ openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl 25 May 2018 08:43:17 -0000 1.71 @@ -25,11 +25,7 @@ } { is this party a person? Cached } { - if {[db_0or1row contact_person_exists_p {select '1' from persons where person_id = :party_id}]} { - return 1 - } else { - return 0 - } + return [db_0or1row contact_person_exists_p {select '1' from persons where person_id = :party_id}] } ad_proc -public person::new { @@ -338,30 +334,24 @@ @result dict of attributes @author Lars Pind (lars@collaboraid.biz) -} { +} { if { $user_id eq "" } { - if { $username eq "" } { - set user_id [ad_conn user_id] - } else { - if { $authority_id eq "" } { - set authority_id [auth::authority::local] - } - } + set user_id [expr {$username ne "" ? \ + [acs_user::get_by_username \ + -authority_id $authority_id -username $username] : \ + [ad_conn user_id]}] } - if { $user_id ne "" } { - set data [util_memoize [list acs_user::get_from_user_id_not_cached $user_id] [cache_timeout]] - } else { - set data [util_memoize [list acs_user::get_from_username_not_cached $username $authority_id] [cache_timeout]] - } - + set data [util_memoize [list acs_user::get_from_user_id_not_cached $user_id] [cache_timeout]] if { $include_bio_p } { - lappend data bio [person::get_bio -person_id [dict get $data user_id]] + lappend data bio [person::get_bio -person_id $user_id] } + if {[info exists array]} { upvar $array row array set row $data } + return $data } @@ -376,17 +366,6 @@ return [array get row] } -ad_proc -private acs_user::get_from_username_not_cached { username authority_id } { - Returns an array list with user info from the database. Should - never be called from application code. Use acs_user::get instead. - - @author Peter Marklund -} { - db_1row select_user_info {} -column_array row - - return [array get row] -} - ad_proc -private acs_user::cache_timeout {} { Returns the number of seconds the user info cache is kept. Index: openacs-4/packages/acs-tcl/tcl/community-core-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/community-core-procs.xql,v diff -u -r1.29 -r1.30 --- openacs-4/packages/acs-tcl/tcl/community-core-procs.xql 21 Feb 2018 14:00:56 -0000 1.29 +++ openacs-4/packages/acs-tcl/tcl/community-core-procs.xql 25 May 2018 08:43:17 -0000 1.30 @@ -187,43 +187,6 @@ where user_id = :user_id - - - - + - select user_id, - username, - authority_id, - first_names, - last_name, - first_names || ' ' || last_name as name, - email, - url, - screen_name, - priv_name, - priv_email, - email_verified_p, - email_bouncing_p, - no_alerts_until, - last_visit, - to_char(last_visit, 'YYYY-MM-DD HH24:MI:SS') as last_visit_ansi, - second_to_last_visit, - to_char(second_to_last_visit, 'YYYY-MM-DD HH24:MI:SS') as second_to_last_visit_ansi, - n_sessions, - password_question, - password_answer, - password_changed_date, - member_state, - rel_id, - extract(day from current_date - password_changed_date) as password_age_days, - creation_date, - creation_ip - from cc_users - where authority_id = :authority_id - and lower(username) = lower(:username) - - - -