function quotes_node_access in Quotes 7
Implements hook_node_access().
File
- ./
quotes.module, line 60 - The quotes module allows users to maintain a list of quotes that can be displayed in any number of administrator-defined quote blocks.
Code
function quotes_node_access($node, $op, $account) {
$type = is_string($node) ? $node : $node->type;
if ($type == 'quotes') {
switch ($op) {
case 'create':
if (user_access('create quotes', $account) || user_access('import quotes', $account) || user_access('edit own quotes', $account)) {
return NODE_ACCESS_ALLOW;
}
break;
case 'update':
if (user_access('edit own quotes', $account) && $account->uid == $node->uid) {
return NODE_ACCESS_ALLOW;
}
break;
case 'delete':
if (user_access('edit own quotes', $account) && $account->uid == $node->uid) {
return NODE_ACCESS_ALLOW;
}
if (user_access('administer quotes', $account)) {
return NODE_ACCESS_ALLOW;
}
break;
case 'view':
if (user_access('access quotes', $account)) {
return NODE_ACCESS_ALLOW;
}
break;
}
}
// Returning nothing from this function would have the same effect.
return NODE_ACCESS_IGNORE;
}