I have a node-type called "download" that has a field "file" with unlimited entries. Those files are already stored inside a private path. Now I want to restrict access only to a certain role. I already tried field_permissions but when I enable View field_file, regardless of content author. and grant that permission only to authenticated users, I still can view/download that file as a guest. What am I doing wrong here?

Besides it would be nice to set permissions on a node base. Like "This Node is only Viewable by Role XYZ".

Thanks for any hints!

3 Answers 3


like Colin McClure says, to control per node you can use with http://drupal.org/project/content_access .In the respective Access Control tab of each Content Type (when you edit a content type), you will find, in the bottom, the option to enable per content node access control settings.

About control per fields, seems that exist several modules to achive this:

and, from this resource you can find hooks to get permissions per field:



 *  Implementation of hook_perm().
function content_permissions_perm() {
  $perms = array();
  foreach (content_fields() as $field) {
    $perms[] = 'edit '. $field['field_name'];
    $perms[] = 'view '. $field['field_name'];
  return $perms;

 * Implementation of hook_field_access().
 * @see content_access().
function content_permissions_field_access($op, $field, $account, $node = NULL) {
  switch ($op) {
    case 'view':
    case 'edit':
      return user_access($op .' '. $field['field_name'], $account);
  return TRUE;
  • Nice, that solves at least the "on a node base"-permission-problem. ^^ Stil can view the files attached to that node which i do not have access to, though in private folder.
    – nocksock
    Aug 19, 2011 at 11:55
  • If I understand well, this indication could be useful drupal.org/node/1175654
    – cigotete
    Aug 20, 2011 at 5:10

If you are looking to set permissions on a node basis then you need another module called Content Access. Do bear in mind though that the more ACL permissions you use the slower the site will become. Unfortunately, this is a side effect.

  • Nice Module. Yet this does not solve my main-problem with the images. I still can view images which i should not have access to.
    – nocksock
    Aug 19, 2011 at 11:55

For the actual download ability, you can try https://www.drupal.org/project/private_files_download_permission.

...a simple permission to allow downloading of private files by role...

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.