oacs_dav::conn_setup (public)
oacs_dav::conn_setup
Defined in packages/oacs-dav/tcl/oacs-dav-procs.tcl
Setup oacs_dav::conn, authenticate user
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: ad_conn -reset set uri [ns_urldecode [ns_conn url]] ns_log debug "\nconn_setp uri \"$uri\" " set dav_url_regexp "^[oacs_dav::uri_prefix]" regsub $dav_url_regexp $uri {} uri if {$uri eq ""} { set uri "/" } oacs_dav::conn -set uri $uri set method [ns_conn method] ns_log debug "\noacs_dav::conn_setup: uri \"$uri\" method $method" oacs_dav::set_user_id ns_log debug "\noacs_dav::conn_setup: uri \"$uri\" method $method user_id [oacs_dav::conn user_id]" array set sn [oacs_dav::request_site_node $uri] set node_id [oacs_dav::conn -set node_id $sn(node_id)] set package_id [oacs_dav::conn -set package_id $sn(package_id)] set folder_id [oacs_dav::conn -set folder_id [oacs_dav::request_folder_id [oacs_dav::conn node_id]]] set urlv [oacs_dav::conn -set urlv [split [string trimright $uri "/"] "/"]] set destination [ns_urldecode [ns_set iget [ns_conn headers] Destination]] regsub {https?://[^/]+/} $destination {/} dest regsub $dav_url_regexp $dest {} dest oacs_dav::conn -set oacs_destination $dest if {$dest ne ""} { oacs_dav::conn -set dest_parent_id [oacs_dav::item_parent_folder_id $dest] } # we need item_id and content_type # we should use content::init but that has caching and I don't # have time to resolve the issues that raises right now # a full-featured, consistently used Tcl API for CR will fix that if {[llength $urlv] > 2} { set parent_url [join [lrange $urlv 0 [llength $urlv]-2] "/" ] } else { set parent_url "/" } ns_log debug "\noacs_dav::conn_setup: handle request parent_url $parent_url length urlv [llength $urlv] urlv $urlv" set item_name [lindex $urlv end] if {$item_name eq ""} { # for propget etc we need the name of the folder # the last element in urlv for a folder is an empty string set item_name [lindex [split [string trimleft $parent_url "/"] "/"] end] } oacs_dav::conn -set item_name $item_name ns_log debug "\noacs_dav::conn_setup: handle request parent_url $parent_url length urlv [llength $urlv] urlv $urlv item_name $item_name" set parent_id [oacs_dav::item_parent_folder_id $uri] set item_id [oacs_dav::conn -set item_id [db_exec_plsql get_item_id ""]] ns_log debug "\noacs_dav::conn_setup: uri $uri parent_url $parent_url folder_id $folder_id" if {[string trimright $uri "/"] eq [string trimright $sn(url) "/"]} { set item_id [oacs_dav::conn -set item_id $folder_id] } ns_log debug "\noacs_dav::conn_setup: item_id $item_id"Generic XQL file: packages/oacs-dav/tcl/oacs-dav-procs.xql
PostgreSQL XQL file: <fullquery name="oacs_dav::conn_setup.get_item_id"> <querytext> select content_item__get_id(:item_name,:parent_id,'f') </querytext> </fullquery>packages/oacs-dav/tcl/oacs-dav-procs-postgresql.xql
Oracle XQL file: <fullquery name="oacs_dav::conn_setup.get_item_id"> <querytext> begin :1 := content_item.get_id( item_path => :item_name, root_folder_id => :parent_id, resolve_index => 'f'); end; </querytext> </fullquery>packages/oacs-dav/tcl/oacs-dav-procs-oracle.xql