You are here

function recipe_access in Recipe 5

Same name and namespace in other branches
  1. 6 recipe.module \recipe_access()

Implementation of hook_access().

File

./recipe.module, line 474
recipe.module - share recipes for drupal 5.x

Code

function recipe_access($op, $node) {
  global $user;
  if ($op == 'create') {

    // Only users with permission to do so may create this node type.
    return user_access('create recipes');
  }

  // Users who create a node may edit or delete it later, assuming they have the
  // necessary permissions.
  if ($op == 'update' || $op == 'delete') {
    if (user_access('edit own recipes') && $user->uid == $node->uid) {
      return TRUE;
    }
  }
}