You are here

function quiz_question_node_access_records in Quiz 7.6

Same name and namespace in other branches
  1. 7.4 question_types/quiz_question/quiz_question.module \quiz_question_node_access_records()
  2. 7.5 question_types/quiz_question/quiz_question.module \quiz_question_node_access_records()

Implements hook_node_access_records().

File

question_types/quiz_question/quiz_question.module, line 974
Quiz Question module. This module provides the basic facilities for adding quiz question types to a quiz.

Code

function quiz_question_node_access_records($node) {
  $grants = array();

  // Restricting view access to question nodes outside quizzes.
  $question_types = quiz_question_get_info();
  $question_types = array_keys($question_types);
  if (in_array($node->type, $question_types)) {

    // This grant is for users having 'view quiz question outside of a quiz'
    // permission. We set a priority of 2 because OG has a 1 priority and we
    // want to get around it.
    $grants[] = array(
      'realm' => 'quiz_question',
      'gid' => 1,
      'grant_view' => 1,
      'grant_update' => 0,
      'grant_delete' => 0,
      'priority' => 2,
    );
  }
  return $grants;
}