ad_set_client_property

one of the documented procedures in this installation of the ACS
Usage:
ad_set_client_property { -secure f -browser f -deferred f -persistent t } module name value
What it does:
Sets a client (session- or browser-level) property. If $persistent is true, the new value will be written through to the database. If $deferred is true, the database write will be delayed until connection close (although calls to ad_get_client_property will still return the correct value immediately). If $secure is true, the property will not be retrievable except via a validated, secure (HTTPS) connection.
Defined in: /web/philip/packages/acs-core/security-procs.tcl

Source code:

arg_parser_for_ad_set_client_property $args

    global ad_conn
    
    if { $secure != "f" && $ad_conn(sec_validated) != "secure" } {
	error "Unable to set secure property in insecure or invalid session"
    }

    set kind [ad_decode $browser "t" "browser" "session"]
    set id [ad_get_${kind}_id]

    if { $persistent == "t" } {
	# Write to database - either defer, or write immediately. First delete the old
	# value if any; then insert the new one.

	set dml "
            delete from sec_${kind}_properties
            where ${kind}_id = $id
            and module = '[DoubleApos $module]'
            and property_name = '[DoubleApos $name]'
        "
        if { $deferred == "t" } {
	    ad_defer_dml $dml
        } else {
	    set db [ns_db gethandle log]
	    ns_db dml $db "begin transaction"
	    ns_db dml $db $dml
        }

        set dml "
            insert into sec_${kind}_properties(${kind}_id, module, property_name, property_value, secure_p)
            values($id, '[DoubleApos $module]', '[DoubleApos $name]', empty_clob(), '[DoubleApos $secure]')
            returning property_value into :1
	"
        if { $deferred == "t" } {
	    ad_defer_dml $dml [list $value]
        } else {
	    ns_ora clob_dml $db $dml $value
	    ns_db dml $db "end transaction"
	    ns_db releasehandle $db
        }
    }

    # Remember the new value, seeding the memoize cache with the proper value.
    util_memoize_seed [list sec_lookup_property $browser $id $module $name] [list $value $secure]


philg@mit.edu