You are here

function webform_protected_downloads_access in Webform Protected Downloads 6

Same name and namespace in other branches
  1. 7 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 105
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->files) || !count($node->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;
}