function ctools_node_access_ctools_access_check

Check for access.

1 string reference to 'ctools_node_access_ctools_access_check'
node_access.inc in plugins/access/node_access.inc
Plugin to provide access control based upon node type.

File

plugins/access/node_access.inc, line 48

Code

function ctools_node_access_ctools_access_check($conf, $context) {
    // As far as I know there should always be a context at this point, but this
    // is safe.
    list($user_context, $node_context) = $context;
    if (empty($node_context) || empty($node_context->data) || empty($node_context->data->type)) {
        return FALSE;
    }
    if (empty($user_context) || empty($user_context->data)) {
        return FALSE;
    }
    if ($conf['type'] == 'create') {
        return node_access('create', $node_context->data->type, $user_context->data);
    }
    else {
        return node_access($conf['type'], $node_context->data, $user_context->data);
    }
}