function multichoice_access in Quiz 6.6
Same name and namespace in other branches
- 5.2 multichoice.module \multichoice_access()
- 5 multichoice.module \multichoice_access()
- 6.2 multichoice.module \multichoice_access()
- 6.3 question_types/multichoice/multichoice.module \multichoice_access()
- 6.5 question_types/multichoice/multichoice.module \multichoice_access()
Implementation of hook_access().
File
- question_types/
multichoice/ multichoice.module, line 83 - Multiple choice question type for the Quiz module.
Code
function multichoice_access($op, $node, $account) {
// Quiz administrator can do anything.
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 multichoice', $account);
case 'update':
if (user_access('edit any multichoice', $account) || user_access('edit own multichoice', $account) && $account->uid == $node->uid) {
return TRUE;
}
case 'delete':
if (user_access('delete any multichoice', $account) || user_access('delete own multichoice', $account) && $account->uid == $node->uid) {
return TRUE;
}
}
}