1

My scenario is as follows:

I'd like to create 2 node types "public file" and "private file". Each node type has the file field for file uploads. I would like the ability to assign user permissions to any file that is uploaded to the private node type. The users would be managed through the Drupal User module.

Thanks in advance!

2
  • 1
    I'm not sure it's clear exactly what you're trying to accomplish. You wouldn't typically create a node type of public/private file.
    – Craig
    Commented Feb 5, 2014 at 21:26
  • I have a content type called "private file". There are many fields included and one of the fields is a file field where users can upload a file to the content type. I want to add user permissions to the file that is uploaded. I may be going about this the wrong way, I'm not sure. I am just looking for a easy way to apply permissions to files and that is synched with the Drupal users table.
    – user26105
    Commented Feb 5, 2014 at 22:54

1 Answer 1

0

The closest out-of-the-box option is to use a combination of the public (public://) and private (private://) file system. Public files can be access by anyone with a url to the file. They're served directly from the server without really having to deal with drupal. Private files on the other hand require the user to log in.

The downside to the private file system is the files are basically streamed to the end user via php which is slower. There are ways around this but if you're not expecting heavy download traffic then I wouldn't worry about it just yet.

The way access control is handled is via the node. You can create a single filefield and attach it to a any content type. Let's just say we're using the 'article' content type for now with a single filefield that supports both public and private storage. When you add a file to the article you can choose the private file system. You can then use any of the node access control modules (tac_lite, og, etc.) to control who can see the node. Those that can see the node can then download the file.

1
  • Thank you for your confirming my original thoughts. I didn't see any kind of module or technique available to accomplish this and just wanted to be sure. I think I will try creating a unique relation between user and the file node and then filter the view results through php.
    – user26105
    Commented Feb 6, 2014 at 16:17

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.