function simpletest_example_access
Implementation of hook_access().
Related topics
File
-
simpletest_example/
simpletest_example.module, line 49
Code
function simpletest_example_access($op, $node) {
global $user;
if ($op == 'create') {
return user_access('create simpletest_example');
}
// This code has a BUG that we'll find in testing
// Correct version
// if ($op == 'update' || $op == 'delete') {
// Incorrect version we'll use to demonstrate test failure. We were always testing
// with User 1, so it always allowed access and the bug wasn't noticed!
if ($op == 'delete') {
return user_access('edit own simpletest_example') && $user->uid == $node->uid;
}
}