You are here

function faq_access in Frequently Asked Questions 5

Same name and namespace in other branches
  1. 5.2 faq.module \faq_access()
  2. 6 faq.module \faq_access()

Implementation of hook_access()

File

./faq.module, line 39

Code

function faq_access($op, $node) {
  global $user;
  if ($op == 'create') {
    if (user_access('create faq') || user_access('administer faq')) {
      return TRUE;
    }
  }
  else {
    if ($op == 'update' || $op == 'delete') {
      if (user_access('edit faq') || user_access('administer faq')) {
        return TRUE;
      }
      else {
        if (user_access('edit own faq') && $user->uid == $node->uid) {
          return TRUE;
        }
      }
    }
    else {
      if ($op == 'view') {
        return user_access('view faq');
      }
    }
  }
}