scrub_access_to_unified_topics

one of the documented procedures in this installation of the ACS
Usage:
scrub_access_to_unified_topics   db   user_id
What it does:
Changes bboard_unified to ensure that user_id does not have unauthorized access to any forums
Defined in: /web/philip/tcl/bboard-unified.tcl

Source code:


    set scrub_topics [list]

    set selection [ns_db select $db "
    SELECT DISTINCT bboard_unified.topic_id AS topic_id, 
                    bboard_topics.read_access AS read_access
    FROM bboard_topics, bboard_unified
    WHERE bboard_topics.topic_id = bboard_unified.topic_id
    AND   bboard_topics.read_access not in ('any', 'public')
    AND   bboard_unified.topic_id = $user_id
    "]
    
    set count 0
    while { [ns_db getrow $db $selection] } {
	set_variables_after_query
	if { !( [validate_bboard_access $topic_id $read_access $user_id] ) } {
	    lappend scrub_topics $topic_id
	    incr count
	}
    }
    
    if { $count == 0 } {
	return
    } elseif { $count == 1 } {
	ns_db dml $db "UPDATE bboard_unified
SET default_topic_p = 'f'
WHERE user_id = $user_id
 AND topic_id = [lindex $scrub_topics 0]"
    } else {
	ns_db dml $db "UPDATE bboard_unified
SET default_topic_p = 'f'
WHERE user_id = $user_id
 AND topic_id in ([join $scrub_topics ", "])"
    }


philg@mit.edu