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; } /** * Access callback for the user entity. */ function ctools_metadata_user_access($op, $entity = NULL, $account = NULL, $entity_type) { $account = isset($account) ? $account : $GLOBALS['user']; // Grant access to the users own user account and to the anonymous one. if (isset($entity) && $op != 'delete' && (($entity->uid == $account->uid && $entity->uid) || (!$entity->uid && $op == 'view'))) { return TRUE; } if (user_access('administer users', $account) || user_access('access user profiles', $account) && $op == 'view' && $entity->status) { return TRUE; } return FALSE; } /** * Access callback for the comment entity. */ function ctools_metadata_comment_access($op, $entity = NULL, $account = NULL) { // When determining access to a comment, if comment has an associated node, // the user must be able to view the node in order to access the comment. if (isset($entity->nid)) { if (!node_access('view', node_load($entity->nid), $account)) { return FALSE; } } // Comment administrators are allowed to perform all operations on all // comments. if (user_access('administer comments', $account)) { return TRUE; } // Unpublished comments can never be accessed by non-admins. if (isset($entity->status) && $entity->status == COMMENT_NOT_PUBLISHED) { return FALSE; } if (user_access('access comments', $account) && $op == 'view') { return TRUE; } return FALSE; } /** * Access callback for the taxonomy entities. */ function ctools_metadata_taxonomy_access($op, $entity = NULL, $account = NULL, $entity_type) { if ($entity_type == 'taxonomy_vocabulary') { return user_access('administer taxonomy', $account); } if (user_access('administer taxonomy', $account) || user_access('access content', $account) && $op == 'view') { return TRUE; } return FALSE; }