You are here

function qcollection_access in Quiz 6.6

Implementation of hook_access().

File

includes/qcollection/qcollection.module, line 39
The main file for qcollection.

Code

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

  // Admin can do all of this.
  if (user_access('administer quiz', $account)) {
    return TRUE;
  }
  if (!user_access('access qcollection')) {

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