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.8 -r1.8.4.1 --- openacs-4/packages/file-storage/www/copy-postgresql.xql 2 Apr 2013 12:04:43 -0000 1.8 +++ openacs-4/packages/file-storage/www/copy-postgresql.xql 3 Jul 2016 18:16:29 -0000 1.8.4.1 @@ -1,6 +1,5 @@ - + @@ -48,18 +47,15 @@ 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 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') + 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 @@ -69,13 +65,15 @@ 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 + 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 + 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/file-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/file-postgresql.xql,v diff -u -r1.16 -r1.16.4.1 --- openacs-4/packages/file-storage/www/file-postgresql.xql 2 Apr 2013 12:04:43 -0000 1.16 +++ openacs-4/packages/file-storage/www/file-postgresql.xql 3 Jul 2016 18:18:20 -0000 1.16.4.1 @@ -45,13 +45,10 @@ where o.object_id = r.revision_id and r.item_id = i.item_id and r.item_id = :file_id - and exists (select 1 - from acs_object_party_privilege_map m - where m.object_id = r.revision_id - and m.party_id = :user_id - and m.privilege = 'read') - $show_versions order by last_modified desc + and acs_permission__permission_p(r.revision_id, :user_id, 'read') + $show_versions order by last_modified desc + Index: openacs-4/packages/file-storage/www/folder-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-chunk-postgresql.xql,v diff -u -r1.18 -r1.18.4.1 --- openacs-4/packages/file-storage/www/folder-chunk-postgresql.xql 2 Apr 2013 12:04:43 -0000 1.18 +++ openacs-4/packages/file-storage/www/folder-chunk-postgresql.xql 3 Jul 2016 18:20:09 -0000 1.18.4.1 @@ -30,13 +30,10 @@ end as new_p from fs_objects where fs_objects.parent_id = :folder_id - and exists (select 1 - from acs_object_party_privilege_map m - where m.object_id = fs_objects.object_id - and m.party_id = :viewing_user_id - and m.privilege = 'read') - $categories_limitation - $orderby + and acs_permission__permission_p(fs_objects.object_id, :viewing_user_id, 'read') + + $categories_limitation + $orderby Index: openacs-4/packages/file-storage/www/move-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/move-postgresql.xql,v diff -u -r1.9 -r1.9.4.1 --- openacs-4/packages/file-storage/www/move-postgresql.xql 2 Apr 2013 12:04:43 -0000 1.9 +++ openacs-4/packages/file-storage/www/move-postgresql.xql 3 Jul 2016 18:22:09 -0000 1.9.4.1 @@ -35,18 +35,14 @@ 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 + 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 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') + 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