Would this be possible?

It would be very useful if, as user 1, I could upload files to user 2's account? Right now, if I view user 2's files and click his "upload file" link, it uploads to my user 1 account, not to his. It would be really tremendous if user 1 could upload files to the other accounts but of course user 2's permissions only allowed him to upload to his own account.

Ideally, my user 1 uploads to user 2 account would be instigated by clicking the the "upload file" that appears under the file tab of the user 2 account. (right now clicking that links uploads files to user 1 account)

This feature would turn this system into a very useful tool to give files to another user. If user 2 submits a file (a student assignment, a document submission, an application letter, etc.) then user one, the root user, can read and then return the document with comments to the original user 2.

There is a large group of Drupal users that create course websites and this ability to return a document to a student without sharing with the class as a whole would be a much more simple method than creating a new content type and creating permissions on that CCK etc. as is the typical way we do this kind of private sharing now. It would also mean I no longer need to use the "view own" module.

Indeed, to make it a bit more complicated, if there was a permission switch that allowed me to allow users to upload to each others accounts, but perhaps one thing at a time.

Again, thanks for all your work. If I could program, I would offer to help. But I don't have those skills.

Best,

Dan
Grand Rapids, MI

Comments

mcarrera’s picture

Subscribe

ddorian’s picture

Hi You can use devel,
It has a block that what it does is that you can login like u are user2(or whatever u like) and what u do:
U login as user2 and upload and done

ddorian’s picture

And as devel is not advised to be used on production u can use this: http://drupal.org/project/masquerade .Change the issue status if you are satisfied.

mcarrera’s picture

I have a similar need, where the admin user will have to upload invoices and assign them to various users.
The approach I am considering is to write a module or a script which will change the uid of the file in the file table, from 1 to the uid of the target user.
The catch is that the files will have to have a name containing the uid or other unequivocal field belonging to the target user.

ddorian’s picture

didn't you try my examples?

larowlan’s picture

Hi
I don't see this being much work.
To start on a patch (mental notes):
1)change the hook_menu so that user/upload-files is user/%user/upload-files
2)change the access callback so that it is similar to the user/%user/files but with a new permission 'upload files to other user accounts' or similar, change the hook_menu at (1) to use this access callback, passing the appropriate access arguments
3)change the menu callback for (1) so it accepts a user argument that defaults to FALSE. If the user argument is not set, use the logged in user. Note this must check for anonymous user - if the user passed is the anonymous user then it has to use the logged in user. (ie don't allow admin to create files for anon user as we can't get the session id - (yes the module support anon users)).
4)change the form builder user_files_upload_form to add an account field (#type=>value) eg
$form['account'] = array(
'#type' => 'value',
'#value' => $account
);
where $account is the user account
5)change user_files_upload_form_submit to use the $form_state['values']['account'] instead of global $user
That's all that's needed - I just need to find time!

larowlan’s picture

In fact change 1) to add a new menu item at user/upload-files/%user so that the argument is optional and then we don't break existing links and the suggested menu item

mcarrera’s picture

Dorian, I haven't tried anything yet as the project has yet to start. Anyway I have to have the admin user to only to upload a file, and let the system take care of the rest (ie assign the doc to the right user). So I guess after all our needs are slightly different. But your approach should work for sure.

geefin’s picture

+1 to this, would *love* to see this implemented as it would be a lovely solution for the simple problem of giving specific users specific files...