You are here

function quiz_question_access in Quiz 6.6

Same name and namespace in other branches
  1. 6.3 question_types/quiz_question/quiz_question.module \quiz_question_access()
  2. 6.4 question_types/quiz_question/quiz_question.module \quiz_question_access()
  3. 6.5 question_types/quiz_question/quiz_question.module \quiz_question_access()

Implementation of hook_access().

File

question_types/quiz_question/quiz_question.module, line 120
Quiz Question module. This module provides the basic facilities for adding quiz question types to a quiz. While you can create standard Quiz question types simply by implementing the appropriate hooks, this module provides a framework that makes…

Code

function quiz_question_access($op, $node, $account) {

  // Allow admin to do whatever.
  if (user_access('administer quiz', $account)) {
    return TRUE;
  }
  switch ($op) {
    case 'view':
      return user_access('view quiz question outside of a quiz');
    case 'create':
      return user_access('create quiz question', $account);
    case 'update':
      if (user_access('edit any quiz question', $account) || user_access('edit own quiz question', $account) && $account->uid == $node->uid) {
        return TRUE;
      }
    case 'delete':
      if (user_access('delete any quiz question', $account) || user_access('delete own quiz question', $account) && $account->uid == $node->uid) {
        return TRUE;
      }
  }
}