You are here

function quiz_access in Quiz 6.4

Same name and namespace in other branches
  1. 5.2 quiz.module \quiz_access()
  2. 5 quiz.module \quiz_access()
  3. 6.6 quiz.module \quiz_access()
  4. 6.2 quiz.module \quiz_access()
  5. 6.3 quiz.module \quiz_access()
  6. 6.5 quiz.module \quiz_access()
  7. 7.5 quiz.module \quiz_access()

Implementation of hook_access().

File

./quiz.module, line 112
Quiz Module

Code

function quiz_access($op, $node, $account) {
  if (!user_access('access quiz', $account)) {

    // If users can't access, they'll get Nothing. Otherwise, we allow further
    // permission checking.
    return FALSE;
  }
  switch ($op) {
    case 'create':
      return user_access('create quiz', $account);
    case 'update':
      return user_access('edit any quiz', $account) || user_access('edit own quiz', $account) && $account->uid == $node->uid;
    case 'delete':
      return user_access('delete any quiz', $account) || user_access('delete own quiz', $account) && $account->uid == $node->uid;
  }
}