1

I am trying to figure out a clean way to do this in drupal 7 but can't find a clean way.

Problem: A user needs to be able to download files without the need to upload any files. Files are placed in private dir or uploaded by admin.

Scenario: A file will be placed in /private/userx directory by non-drupal way (cp file), a user needs access to download the files in own dir?

Requirements: 1. A user doesn't upload files. 2. A user can download his subdir files only. 3. A user can't download other users files.

I searched for solution but none found. I tried EntityForm file but that requires user upload and admin can't upload for a user as per other discussions.

One option is to place the file in a private dir and insert file object in the database with userid, but couldn't find example how to do that.

Any insight will be great help.

1 Answer 1

0

I would use the organic groups module. The idea is to create a content type lets say "userprivatedir" make this a og group and a allow users to create one or more nodes of this type. By default the creator of a og group is the owner of this group. Then i would create another content type lets say "userfile" and make this a og content. Then you may configure og so only the members of the group (i.e. the user that created it has access into it). The "userfile" content type should have a file field that stores files in the drupal private filesystem (so files are not accessible just by hotlinking but only through their node page.

Also if you dont want user to be able to upload at his own "userprivatedir" (i.e. og group node) then create the group node by another manager user and then add only this user (or maybe some more that should see this directory's files) to this node group so they have access.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.