Index: openacs-4/packages/file-storage/www/copy-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/copy-oracle.xql,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/file-storage/www/copy-oracle.xql 15 Mar 2019 10:09:24 -0000 1.7.2.1 +++ openacs-4/packages/file-storage/www/copy-oracle.xql 28 Aug 2019 14:31:41 -0000 1.7.2.2 @@ -41,25 +41,4 @@ - - - select - cf.folder_id, ci1.parent_id, cf.label, ci1.level_num - from cr_folders cf, (select item_id, level as level_num from - cr_items - where cr_items.item_id not in ($object_id_list) - connect by (prior item_id=parent_id and parent_id not in ($object_id_list)) - start with cr_items.item_id = :root_folder_id - ) ci1 - where - ci1.item_id=cf.folder_id - and exists (select 1 - from acs_object_party_privilege_map m - where m.object_id = cf.folder_id - and m.party_id = :user_id - and m.privilege = 'write') - order by ci1.level_num, cf.label - - - Index: openacs-4/packages/file-storage/www/copy-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/copy-postgresql.xql,v diff -u -r1.9.2.1 -r1.9.2.2 --- openacs-4/packages/file-storage/www/copy-postgresql.xql 15 Mar 2019 10:09:24 -0000 1.9.2.1 +++ openacs-4/packages/file-storage/www/copy-postgresql.xql 28 Aug 2019 14:31:41 -0000 1.9.2.2 @@ -38,39 +38,4 @@ - - - select - cf.folder_id, ci1.parent_id, cf.label, tree_level(ci1.tree_sortkey) as level_num - from - cr_folders cf, - cr_items ci1, - cr_items ci2 - where ci1.tree_sortkey between ci2.tree_sortkey and tree_right(ci2.tree_sortkey) - and ci2.item_id=:root_folder_id - and ci1.item_id=cf.folder_id - and acs_permission__permission_p(cf.folder_id, :user_id, 'write') - order by ci1.tree_sortkey, cf.label - - - - - postgresql8.4 - - With folder_tree as ( - select - cf.folder_id, ci1.parent_id, cf.label, - tree_level(ci1.tree_sortkey) as level_num, - acs_permission__permission_p(cf.folder_id, :user_id, 'write') as permission_p - from cr_folders cf, cr_items ci1, cr_items ci2 - where - ci1.tree_sortkey between ci2.tree_sortkey and - tree_right(ci2.tree_sortkey) - and ci2.item_id= :root_folder_id - and ci1.item_id=cf.folder_id - order by ci1.tree_sortkey, cf.label - ) select folder_id, parent_id, label, level_num from folder_tree where permission_p is true; - - - Index: openacs-4/packages/file-storage/www/copy.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/copy.tcl,v diff -u -r1.11.2.2 -r1.11.2.3 --- openacs-4/packages/file-storage/www/copy.tcl 9 Aug 2019 20:25:08 -0000 1.11.2.2 +++ openacs-4/packages/file-storage/www/copy.tcl 28 Aug 2019 14:31:41 -0000 1.11.2.3 @@ -140,7 +140,23 @@ } set object_id $objects_to_copy set cancel_url "[ad_conn url]?[ad_conn query]" - db_multirow -extend {copy_url} folder_tree get_folder_tree "" { + db_multirow -extend {copy_url} folder_tree get_folder_tree { + with recursive folder_tree (folder_id, parent_id, label) as ( + select cf.folder_id, cif.parent_id, cf.label, 1 as level_num + from cr_folders cf, cr_items cif + where cf.folder_id = :root_folder_id + and cf.folder_id = cif.item_id + and acs_permission.permission_p(cf.folder_id, :user_id, 'write') + + union all + + select cf.folder_id, cif.parent_id, cf.label, level_num + 1 as level_num + from cr_folders cf, cr_items cif, folder_tree t + where cif.parent_id = t.folder_id + and cf.folder_id = cif.item_id + and acs_permission.permission_p(cf.folder_id, :user_id, 'write') + ) select * from folder_tree + } { if {$folder_id in [concat $not_allowed_parents $not_allowed_children] || $parent_id in $not_allowed_children } {