Ok so I want to permit some users to download a particular file e.g. in www.mysite.com/sites/default/files/private/somefile.pdf

and everyone else gets access denied.

How do I do this?

Comments

rudolfbyker’s picture

Component: Miscellaneous » User interface
Category: Task » Support request

If the file is in Drupal's private storage, and it is an attachment to a node, the node's access permissions will apply to the file.

How did this file end up on your site? If you uploaded it via FTP and the folder/file permissions on the host is set up correctly, then AFAIK nobody will be able to access it.

amanda-kn’s picture

I created the directory 'private' in 'files'. I then added somefile.pdf via ftp

So you're saying in order to apply access control the file must be uploaded there by drupal itself?

amanda-kn’s picture

I also changed configuration>file system and made the "Private file system path" = sites/default/files/private and set the default download method to "Private local files served by Drupal."

http://i57.tinypic.com/2z8n7fp.jpg

At the moment no one can access anything in that directory

rudolfbyker’s picture

Your private files directory is working as it should. Like I said, the default is to deny access to all users.

You need to have the files linked to entities which have access checking, like nodes. I see three possible solutions:

  • Upload the files in attachment field(s) of a node type. Flexiaccess manages many-to-many relationships between nodes and users, which define permissions which are stored in an ACL in the database. If the user can access the node, she can access the file.
  • If you don't want your files linked to nodes, maybe the ACL module can be extended to include entities in general, and then treat the files as entities using https://drupal.org/project/file_entity
  • Use something like https://drupal.org/project/private_files_download_permission (I have never used/tested this; just a guess).
amanda-kn’s picture

To be perfectly honest I'm new to drupal, would you know of a Youtube video demonstrating how to do this?

gisle’s picture

Assigned: amanda-kn » Unassigned

amanda-kn,
I know of no such video.

If you can make do with text, here is a link to a short tutorial about Drupal file attachments that also deals with access control.

As has alreeady stated by fmr, to control access for a specific uploaded file with Flexi Access, you attach the file to a node, and then use Flexi Access to manage access to the node to which the file is attached.

If you want to use ftp (or some other non-Drupal means) to upload files to your Drupal site, then Flexi Access can not be used for access control to files.

gisle’s picture

Status: Active » Fixed

There has been now further feedback from the OP for a week. I hope that means that this support request is cleared up.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.