You are here

function brightcove_cck_browse_access in Brightcove Video Connect 6

Same name and namespace in other branches
  1. 6.2 brightcove_cck/brightcove_cck.module \brightcove_cck_browse_access()

Access callback for brightcove browser.

Parameters

$node_type: Node type.

$field_name: Field name.

arg(4): Optional node which is edited.

Return value

TRUE if access is allowed, FALSE if access is forbidden.

1 string reference to 'brightcove_cck_browse_access'
brightcove_cck_menu in brightcove_cck/brightcove_cck.module
Implementation of hook_menu().

File

brightcove_cck/brightcove_cck.module, line 73
Brightcove CCK module provides a Content Construction Kit module to developers, allowing them to browse videos in their Brightcove Studio and upload them.

Code

function brightcove_cck_browse_access($node_type, $field_name) {
  if (is_int(arg(4))) {
    $node = node_load(arg(4));
    if (node_access('update', $node) && content_access('edit', $field_name)) {
      return TRUE;
    }
    return FALSE;
  }

  // FIX: this used to pass $field_name to content_access(), but it needs a field array
  // I'm not sure which function is supposed to load the whole field array (b/c we have no $node to work with),
  // so I'm shortcutting it w/ this array, which works for content_permissions
  $field = array(
    'field_name' => $field_name,
  );
  if (node_access('create', $node_type) && content_access('edit', $field)) {
    return TRUE;
  }
  return FALSE;
}