You are here

function quiz_allow_score_access in Quiz 7.5

Same name and namespace in other branches
  1. 7.6 quiz.module \quiz_allow_score_access()
  2. 7.4 quiz.module \quiz_allow_score_access()

Checks if the user has access to save score for his quiz.

File

./quiz.module, line 3071
quiz.module Main file for the Quiz module.

Code

function quiz_allow_score_access($quiz, $account = NULL) {
  global $user;
  if ($account == NULL) {
    $account = $user;
  }
  if (user_access('score any quiz', $account)) {
    return TRUE;
  }
  return user_access('score own quiz', $account) && $quiz->uid == $account->uid;
}