Even with view_unpublished I do not appear to be able to view files attached to unpublished nodes if I am not the author of the node. Any ideas on how to resolve this?
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | view_unpublished_file_attachments_d5_3.patch | 4.8 KB | rooby |
| #4 | view_unpublished_file_attachments_d5_2.patch | 4.71 KB | rooby |
| #3 | view_unpublished_file_attachments_d5.patch | 4.03 KB | rooby |
Comments
Comment #1
entendu commentedHmm, excellent question. I will look into this early next week -- I would start digging around in file attach permissions if you want to get started sooner rather than later! :)
Comment #2
slosa commentedany luck?
Comment #3
rooby commentedI tracked this problem down to the module weight.
Because this module runs before other modules when it does it's hook_nodeapi and redirects it means other modules hook_nodeapis aren't run (for example upload_nodeapi that handles file attachments).
This is an issue because this module also has to run before other modules so that it can take over the menu permissions handling.
This patch addresses this issue by moving the hook_nodeapi out into it's own module which has a weight greater then other modules.
It isn't the greatest looking solution but when you're dealing with module weights and menu altering there isn't much you can do about that.
If this is an issue with the D6 module i'm sure this is easily portable.
Comment #4
rooby commentedThis patch also has some instruction added to the readme.
Comment #5
rooby commentedThis patch has the same functionality as the patch in #4
but it will apply cleanly if you have already applied the patch in #500432: Allow access to view unpublished revisions (and revision tab)
Comment #6
filburt commentedHi,
I could need it in a Drupal 6 version with File Framework module installed. The problem I have is described in #773498: HTTP 403 Error when trying to access unpublished nodes without 'administer nodes' permission What do you think - could it be possible to solve my problem with a Drupal 6 version of the patch provided above?
Thanks for support
Filburt
Comment #7
rooby commentedI have not used the D6 version of this module so I have no idea what has changed between versions.
I have also not used the file framework module before so I can't comment on that either.
If this is still a problem on D6 then this should be able to be ported to 6.
From memory the problem was the module weight interfering.
You needed different weights for different parts of this module, which is why the patch adds a sub module with different weight.
I don't use this module at all anymore as the site it was on had lots of other revision moderation and other modules that this wouldn't work properly with so I don't have the time/resources to work on this anymore.
Comment #8
filburt commentedThanks for the fast reply. I found a solution using the Workflow module to manage the handling of unpublished file attachments.
I described it here: #773498: HTTP 403 Error when trying to access unpublished nodes without 'administer nodes' permission
Greetings
Filburt
Comment #9
filburt commentedComment #10
this_is_it commentedwhat if i just don't wanna use workflow module? after all workflow is a relatively 'big' module, it may bring some unpredicted affections on the existing functions.
i have debugged this problem.
function 'file_download' in the file 'includes/file.inc' implements the file downloading logic.
it calls function module_invoke_all to invoke the module which implements hook_file_download, if the returning array contains '-1', then it complains 'access denied' indicating that current user has not the rights to download file attachments.
eventually i tracked drupal core optional module 'upload', the hook is 'upload_file_download' as follows:
then i changed this clause:
to
just eliminating 'node_access('view',$node)' u could pass the permission check and also view/download file attachments to unpublished nodes. i have not found any side-effects in my site until now.
maybe i should explain a bit more why 'node_access('view',$node)' should be eliminated in order to meet the goal, the reason lies that 'node_access('view',$node)' would always return false if its argument '$node' is an unpublished node. i copy 'node_access' function as follows:
you see that as for unpublished node whose $node->status is 0, it does not satisfy
'if ($op != 'create' && $node->nid && $node->status) {', so we come to'if ($op == 'view' && $account->uid == $node->uid && $account->uid != 0) {', if the author of unpublished node is not current user, it would also not satisfy'$account->uid == $node->uid '.at last function 'node_access' returns false.
so i wanna say it's something concerning drupal core functions. hoping posting this is useful for somebody.
Comment #11
entendu commented