Index: openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql,v diff -u -r1.39 -r1.39.2.1 --- openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql 15 Jun 2018 15:11:04 -0000 1.39 +++ openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql 15 Mar 2019 09:58:23 -0000 1.39.2.1 @@ -37,34 +37,6 @@ - - - select fs_objects.object_id, - fs_objects.name, - fs_objects.title, - fs_objects.live_revision, - fs_objects.type, - to_char(fs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, - fs_objects.content_size, - fs_objects.url, - fs_objects.key, - fs_objects.sort_key, - fs_objects.file_upload_name, - case when fs_objects.last_modified >= (sysdate - :n_past_days) then 1 else 0 end as new_p, - acs_permission.permission_p(fs_objects.object_id, :user_id, 'admin') as admin_p, - acs_permission.permission_p(fs_objects.object_id, :user_id, 'delete') as delete_p, - acs_permission.permission_p(fs_objects.object_id, :user_id, 'write') as write_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 = :user_id - and m.privilege = 'read') - order by fs_objects.sort_key, fs_objects.name - - - begin @@ -94,15 +66,6 @@ - - - select count(*) - from cr_revisions - where item_id = :child_item_id - and acs_permission.permission_p(revision_id, :user_id, :privilege) = 'f' - - - begin @@ -214,20 +177,4 @@ - - - - select cr_items.item_id as object_id, - cr_items.name - from cr_items - where cr_items.parent_id = :folder_id - and exists (select 1 - from acs_object_party_privilege_map m - where m.object_id = cr_items.item_id - and m.party_id = :user_id - and m.privilege = 'read') - - - - Index: openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql,v diff -u -r1.51 -r1.51.2.1 --- openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 15 Jun 2018 15:11:04 -0000 1.51 +++ openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 15 Mar 2019 09:58:23 -0000 1.51.2.1 @@ -31,46 +31,6 @@ - - - - select cr_items.item_id as object_id, cr_items.name - from cr_items - where cr_items.parent_id = :folder_id - and acs_permission__permission_p(cr_items.item_id, :user_id, 'read') - - - - - - postgresql8.4 - - - select fs_objects.object_id, - fs_objects.name, - fs_objects.title, - fs_objects.live_revision, - fs_objects.type, - to_char(fs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, - fs_objects.content_size, - fs_objects.url, - fs_objects.key, - fs_objects.sort_key, - fs_objects.file_upload_name, - fs_objects.title, - case when fs_objects.last_modified >= (now() - interval '$n_past_days days') then 1 else 0 end as new_p, - acs_permission__permission_p(fs_objects.object_id, :user_id, 'admin') as admin_p, - acs_permission__permission_p(fs_objects.object_id, :user_id, 'delete') as delete_p, - acs_permission__permission_p(fs_objects.object_id, :user_id, 'write') as write_p - from fs_objects - where fs_objects.parent_id = :folder_id - and acs_permission__permission_p(fs_objects.object_id, :user_id, 'read') - order by fs_objects.sort_key, fs_objects.name - - - - - select file_storage__get_folder_name(:folder_id); @@ -97,15 +57,6 @@ - - - select count(*) - from cr_revisions - where item_id = :child_item_id - and acs_permission__permission_p(revision_id, :user_id, :privilege) = 'f' - - - select file_storage__get_title(:item_id) Index: openacs-4/packages/file-storage/tcl/file-storage-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs.tcl,v diff -u -r1.90 -r1.90.2.1 --- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 6 Dec 2018 15:48:10 -0000 1.90 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 15 Mar 2019 09:58:23 -0000 1.90.2.1 @@ -99,7 +99,12 @@ # now check revisions db_foreach child_items {} { - incr num_wo_perm [db_string revision_perms {}] + incr num_wo_perm [db_string revision_perms { + select count(*) + from cr_revisions + where item_id = :child_item_id + and not acs_permission.permission_p(revision_id, :user_id, :privilege) + }] } if { $num_wo_perm > 0 } { @@ -407,7 +412,12 @@ permission) } { - return [db_list select_folder_contents {}] + return [db_list select_folder_contents { + select cr_items.item_id as object_id, cr_items.name + from cr_items + where cr_items.parent_id = :folder_id + and acs_permission.permission_p(cr_items.item_id, :user_id, 'read') + }] } ad_proc -public fs::get_folder_contents { @@ -445,7 +455,28 @@ set user_id [acs_magic_object the_public] } - set list_of_ns_sets [db_list_of_ns_sets select_folder_contents {}] + set list_of_ns_sets [db_list_of_ns_sets select_folder_contents { + select fs_objects.object_id, + fs_objects.name, + fs_objects.title, + fs_objects.live_revision, + fs_objects.type, + to_char(fs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, + fs_objects.content_size, + fs_objects.url, + fs_objects.key, + fs_objects.sort_key, + fs_objects.file_upload_name, + fs_objects.title, + fs_objects.last_modified >= (current_timestamp - cast('$n_past_days days' as interval)) as new_p, + acs_permission.permission_p(fs_objects.object_id, :user_id, 'admin') as admin_p, + acs_permission.permission_p(fs_objects.object_id, :user_id, 'delete') as delete_p, + acs_permission.permission_p(fs_objects.object_id, :user_id, 'write') as write_p + from fs_objects + where fs_objects.parent_id = :folder_id + and acs_permission.permission_p(fs_objects.object_id, :user_id, 'read') + order by fs_objects.sort_key, fs_objects.name + }] foreach set $list_of_ns_sets { # in plain Tcl: Fisheye: Tag 1.17.2.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/www/file-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.19.2.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/www/file-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/www/file.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file.tcl,v diff -u -r1.39 -r1.39.2.1 --- openacs-4/packages/file-storage/www/file.tcl 28 Jun 2018 12:30:28 -0000 1.39 +++ openacs-4/packages/file-storage/www/file.tcl 15 Mar 2019 10:06:29 -0000 1.39.2.1 @@ -146,7 +146,34 @@ } } -db_multirow -unclobber -extend { author_link last_modified_pretty content_size_pretty version_url version_delete version_delete_url} version version_info {} { +db_multirow -unclobber -extend { + author + author_link + last_modified_pretty + content_size_pretty + version_url + version_delete + version_delete_url +} version version_info [subst { + select r.title, + r.revision_id as version_id, + o.creation_user as author_id, + r.mime_type as type, + m.label as pretty_type, + to_char(o.last_modified,'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, + r.description, + acs_permission.permission_p(r.revision_id,:user_id,'admin') as admin_p, + acs_permission.permission_p(r.revision_id,:user_id,'delete') as delete_p, + coalesce(r.content_length,0) as content_size + from acs_objects o, cr_items i,cr_revisions r + left join cr_mime_types m on r.mime_type=m.mime_type + where o.object_id = r.revision_id + and r.item_id = i.item_id + and r.item_id = :file_id + and acs_permission.permission_p(r.revision_id, :user_id, 'read') + $show_versions order by last_modified desc +}] { + set author [person::name -person_id $author_id] # FIXME urlencode each part of the path # set file_url [ad_urlencode $file_url] set last_modified_ansi [lc_time_system_to_conn $last_modified_ansi]