You are here

function webform_protected_downloads_access in Webform Protected Downloads 7

Same name and namespace in other branches
  1. 6 webform_protected_downloads.module \webform_protected_downloads_access()

Custom access callback

Parameters

object $node:

Return value

boolean

1 string reference to 'webform_protected_downloads_access'
webform_protected_downloads_menu in ./webform_protected_downloads.module
Implementation of hook_menu().

File

./webform_protected_downloads.module, line 129
This file contains hook declarations and functions for the Webform Protected Downloads module.

Code

function webform_protected_downloads_access($op, $node) {
  switch ($op) {
    case 'view':

      // first check if there are any files attached to this node
      if (!isset($node->wpd['private_files']) || !count($node->wpd['private_files'])) {
        return FALSE;
      }
      return node_access($op, $node);
      break;
    case 'update':
      return node_access($op, $node) && user_access('administer webform protected downloads');
      break;
  }
  return FALSE;
}