function ctools_metadata_no_hook_node_access

Access callback for the node entity.

This function does not implement hook_node_access(), thus it may not be called ctools_metadata_node_access().

Parameters

$op: The operation being performed. One of 'view', 'update', 'create' or 'delete'.

$node: A node to check access for. Must be a node object. Must have nid, except in the case of 'create' operations.

$account: The user to check for. Leave it to NULL to check for the global user.

Return value

bool TRUE if access is allowed, FALSE otherwise.

Throws

EntityMalformedException

See also

entity_access()

1 string reference to 'ctools_metadata_no_hook_node_access'
_ctools_entity_access in includes/entity-access.inc
Core hack to include entity api-esque 'access callback' functions to core entities without needing to rely on entity api. Exception: We don't touch file entity. You must have entity API enabled to view files.

File

includes/entity-access.inc, line 74

Code

function ctools_metadata_no_hook_node_access($op, $node = NULL, $account = NULL) {
    // First deal with the case where a $node is provided.
    if (isset($node)) {
        // If a non-default revision is given, incorporate revision access.
        $default_revision = node_load($node->nid);
        if ($node->vid !== $default_revision->vid) {
            return _node_revision_access($node, $op, $account);
        }
        else {
            return node_access($op, $node, $account);
        }
    }
    // No node is provided. Check for access to all nodes.
    if (user_access('bypass node access', $account)) {
        return TRUE;
    }
    if (!user_access('access content', $account)) {
        return FALSE;
    }
    if ($op == 'view' && node_access_view_all_nodes($account)) {
        return TRUE;
    }
    return FALSE;
}