From f432bebff284b3e0409228c399fccdfcf5dc0b8f Mon Sep 17 00:00:00 2001 From: skodak Date: Thu, 24 Jul 2008 21:59:13 +0000 Subject: [PATCH] MDL-11421 context levels fixed in capability definitions, sorting of caps by name, plug-ins may report used core caps, fixed some risks; merged from MOODLE_19_STABLE --- blocks/moodleblock.class.php | 3 + blocks/rss_client/block_rss_client.php | 2 +- blocks/rss_client/db/access.php | 8 +- enrol/authorize/db/access.php | 2 +- enrol/authorize/version.php | 2 +- lib/accesslib.php | 120 +++++++++++-------------- lib/db/access.php | 52 +++++------ mod/assignment/lib.php | 7 ++ mod/chat/lib.php | 7 ++ mod/choice/lib.php | 9 +- mod/data/lib.php | 8 ++ mod/forum/lib.php | 7 ++ mod/glossary/lib.php | 7 ++ mod/hotpot/lib.php | 7 ++ mod/label/lib.php | 7 ++ mod/lesson/lib.php | 7 ++ mod/quiz/lib.php | 20 +++++ mod/resource/lib.php | 8 ++ mod/scorm/lib.php | 7 ++ mod/survey/lib.php | 7 ++ mod/wiki/lib.php | 6 ++ version.php | 2 +- 22 files changed, 204 insertions(+), 101 deletions(-) diff --git a/blocks/moodleblock.class.php b/blocks/moodleblock.class.php index 9a1b144234d..68ad34da72c 100644 --- a/blocks/moodleblock.class.php +++ b/blocks/moodleblock.class.php @@ -795,6 +795,9 @@ class block_base { return true; } + function get_extra_capabilities() { + return array(); + } } /** diff --git a/blocks/rss_client/block_rss_client.php b/blocks/rss_client/block_rss_client.php index 5247495ba51..1ce01c01e4a 100644 --- a/blocks/rss_client/block_rss_client.php +++ b/blocks/rss_client/block_rss_client.php @@ -19,7 +19,7 @@ function init() { $this->title = get_string('feedstitle', 'block_rss_client'); - $this->version = 2007101509; + $this->version = 2007101511; $this->cron = 300; /// Set min time between cron executions to 300 secs (5 mins) } diff --git a/blocks/rss_client/db/access.php b/blocks/rss_client/db/access.php index b8cec59f3fa..9f77fdf38f4 100644 --- a/blocks/rss_client/db/access.php +++ b/blocks/rss_client/db/access.php @@ -36,7 +36,7 @@ $block_rss_client_capabilities = array( 'block/rss_client:createprivatefeeds' => array( 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_BLOCK, 'legacy' => array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, @@ -49,7 +49,7 @@ $block_rss_client_capabilities = array( 'riskbitmask' => RISK_SPAM, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_BLOCK, 'legacy' => array( 'editingteacher' => CAP_ALLOW, 'admin' => CAP_ALLOW @@ -59,7 +59,7 @@ $block_rss_client_capabilities = array( 'block/rss_client:manageownfeeds' => array( 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_BLOCK, 'legacy' => array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, @@ -72,7 +72,7 @@ $block_rss_client_capabilities = array( 'riskbitmask' => RISK_SPAM, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_BLOCK, 'legacy' => array( 'admin' => CAP_ALLOW ) diff --git a/enrol/authorize/db/access.php b/enrol/authorize/db/access.php index 04ece9ab3c8..084cbcbc1a3 100644 --- a/enrol/authorize/db/access.php +++ b/enrol/authorize/db/access.php @@ -14,7 +14,7 @@ $enrol_authorize_capabilities = array( 'enrol/authorize:uploadcsv' => array( 'riskbitmask' => RISK_XSS, 'captype' => 'write', - 'contextlevel' => CONTEXT_USER, + 'contextlevel' => CONTEXT_SYSTEM, 'legacy' => array( 'admin' => CAP_ALLOW ) diff --git a/enrol/authorize/version.php b/enrol/authorize/version.php index 32e867fef69..baba6a152a2 100755 --- a/enrol/authorize/version.php +++ b/enrol/authorize/version.php @@ -1,6 +1,6 @@ version = 2008020500; +$plugin->version = 2008020501; $plugin->requires = 2007101507; ?> diff --git a/lib/accesslib.php b/lib/accesslib.php index c85c4d6114c..cad7e53f180 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -3311,106 +3311,94 @@ function print_context_name($context, $withprefix = true, $short = false) { * `component` varchar(100) NOT NULL, */ function fetch_context_capabilities($context) { - global $DB; + global $DB, $CFG; - $sort = 'ORDER BY contextlevel,component,id'; // To group them sensibly for display - $params = null; + $sort = 'ORDER BY contextlevel,component,name'; // To group them sensibly for display + + $params = array(); switch ($context->contextlevel) { case CONTEXT_SYSTEM: // all - $sql = "SELECT * FROM {capabilities}"; + $SQL = "SELECT * + FROM {capabilities}"; break; case CONTEXT_USER: - $sql = "SELECT * + $extracaps = array('moodle/grade:viewall'); + list($extra, $params) = $DB->get_in_or_equal($extracaps, SQL_PARAMS_NAMED, 'cap0'); + $SQL = "SELECT * FROM {capabilities} - WHERE contextlevel = ".CONTEXT_USER; + WHERE contextlevel = ".CONTEXT_USER." + OR name $extra"; break; - case CONTEXT_COURSECAT: // all - $sql = "SELECT * FROM {capabilities}"; + case CONTEXT_COURSECAT: // course category context and bellow + $SQL = "SELECT * + FROM {capabilities} + WHERE contextlevel IN (".CONTEXT_COURSECAT.",".CONTEXT_COURSE.",".CONTEXT_MODULE.",".CONTEXT_BLOCK.")"; break; - case CONTEXT_COURSE: // all - $sql = "SELECT * FROM {capabilities}"; - break; - - case CONTEXT_GROUP: // group caps + case CONTEXT_COURSE: // course context and bellow + $SQL = "SELECT * + FROM {capabilities} + WHERE contextlevel IN (".CONTEXT_COURSE.",".CONTEXT_MODULE.",".CONTEXT_BLOCK.")"; break; case CONTEXT_MODULE: // mod caps - $cm = $DB->get_record('course_modules', array('id'=>$context->instanceid)); + $cm = $DB->get_record('course_modules', array('id'=>$context->instanceid)); $module = $DB->get_record('modules', array('id'=>$cm->module)); - $sql = "SELECT * + $extra = ""; + $modfile = "$CFG->dirroot/mod/$module->name/lib.php"; + if (file_exists($modfile)) { + include_once($modfile); + $modfunction = $module->name.'_get_extra_capabilities'; + if (function_exists($modfunction)) { + if ($extracaps = $modfunction()) { + list($extra, $params) = $DB->get_in_or_equal($extracaps, SQL_PARAMS_NAMED, 'cap0'); + $extra = "OR name $extra"; + } + } + } + + $SQL = "SELECT * FROM {capabilities} - WHERE contextlevel = ".CONTEXT_MODULE." AND component = ?"; - $params = array("mod/$module->name"); + WHERE contextlevel = ".CONTEXT_MODULE." + AND component = :component + $extra"; + $params['component'] = "mod/$module->name"; break; case CONTEXT_BLOCK: // block caps - $cb = $DB->get_record('block_instance', array('id'=>$context->instanceid)); + $cb = $DB->get_record('block_instance', array('id'=>$context->instanceid)); $block = $DB->get_record('block', array('id'=>$cb->blockid)); - $sql = "SELECT * + $extra = ""; + if ($blockinstance = block_instance($block->name)) { + if ($extracaps = $blockinstance->get_extra_capabilities()) { + list($extra, $params) = $DB->get_in_or_equal($extracaps, SQL_PARAMS_NAMED, 'cap0'); + $extra = "OR name $extra"; + } + } + + $SQL = "SELECT * FROM {capabilities} - WHERE (contextlevel = ".CONTEXT_BLOCK." AND component = 'moodle') OR (component = ?)"; - $params = array("block/$block->name"); + WHERE (contextlevel = ".CONTEXT_BLOCK." + AND component = :component) + $extra"; + $params['component'] = "block/$block->name"; break; default: return false; } - $records = $DB->get_records_sql($sql.' '.$sort, $params); - -/// the rest of code is a bit hacky, think twice before modifying it :-( - - // special sorting of core system capabiltites and enrollments - if (in_array($context->contextlevel, array(CONTEXT_SYSTEM, CONTEXT_COURSECAT, CONTEXT_COURSE))) { - $first = array(); - foreach ($records as $key=>$record) { - if (preg_match('|^moodle/|', $record->name) and $record->contextlevel == CONTEXT_SYSTEM) { - $first[$key] = $record; - unset($records[$key]); - } else if (count($first)){ - break; - } - } - if (count($first)) { - $records = $first + $records; // merge the two arrays keeping the keys - } - } else { - $contextindependentcaps = fetch_context_independent_capabilities(); - $records = array_merge($contextindependentcaps, $records); + if (!$records = $DB->get_records_sql($SQL.' '.$sort, $params)) { + $records = array(); } return $records; - -} - - -/** - * Gets the context-independent capabilities that should be overrridable in - * any context. - * @return array of capability records from the capabilities table. - */ -function fetch_context_independent_capabilities() { - global $DB; - - //only CONTEXT_SYSTEM capabilities here or it will break the hack in fetch_context_capabilities() - $contextindependentcaps = array( - 'moodle/site:accessallgroups' - ); - - $records = array(); - - foreach ($contextindependentcaps as $capname) { - $record = $DB->get_record('capabilities', array('name'=>$capname)); - array_push($records, $record); - } - return $records; } diff --git a/lib/db/access.php b/lib/db/access.php index 677a259afd3..434cc5dfcee 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -35,7 +35,7 @@ $moodle_capabilities = array( 'moodle/site:doanything' => array( - 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG, + 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG | RISK_DATALOSS, 'captype' => 'admin', 'contextlevel' => CONTEXT_SYSTEM @@ -91,7 +91,7 @@ $moodle_capabilities = array( 'moodle/legacy:admin' => array( - 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG, + 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG | RISK_DATALOSS, 'captype' => 'legacy', 'contextlevel' => CONTEXT_SYSTEM @@ -100,7 +100,7 @@ $moodle_capabilities = array( 'moodle/site:config' => array( - 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG, + 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG | RISK_DATALOSS, 'captype' => 'write', 'contextlevel' => CONTEXT_SYSTEM, @@ -149,7 +149,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'editingteacher' => CAP_ALLOW, 'admin' => CAP_ALLOW @@ -161,7 +161,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'editingteacher' => CAP_ALLOW, 'admin' => CAP_ALLOW @@ -173,7 +173,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'editingteacher' => CAP_ALLOW, 'admin' => CAP_ALLOW @@ -185,7 +185,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_SPAM | RISK_XSS, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_BLOCK, 'legacy' => array( 'editingteacher' => CAP_ALLOW, 'admin' => CAP_ALLOW @@ -195,7 +195,7 @@ $moodle_capabilities = array( 'moodle/site:accessallgroups' => array( 'captype' => 'read', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, @@ -206,7 +206,7 @@ $moodle_capabilities = array( 'moodle/site:viewfullnames' => array( 'captype' => 'read', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, @@ -219,7 +219,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_PERSONAL, 'captype' => 'read', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, @@ -232,7 +232,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_XSS, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'editingteacher' => CAP_ALLOW, 'admin' => CAP_ALLOW @@ -309,7 +309,7 @@ $moodle_capabilities = array( 'moodle/user:viewdetails' => array( 'captype' => 'read', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'guest' => CAP_ALLOW, 'student' => CAP_ALLOW, @@ -324,7 +324,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_PERSONAL, 'captype' => 'read', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, @@ -348,7 +348,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'editingteacher' => CAP_ALLOW, 'admin' => CAP_ALLOW @@ -360,7 +360,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'admin' => CAP_ALLOW ) @@ -371,7 +371,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_SPAM, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'editingteacher' => CAP_ALLOW ) @@ -391,7 +391,7 @@ $moodle_capabilities = array( 'moodle/role:unassignself' => array( 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'student' => (empty($CFG->allowunenrol)) ? CAP_INHERIT : CAP_ALLOW, 'teacher' => CAP_ALLOW, @@ -404,7 +404,7 @@ $moodle_capabilities = array( 'moodle/role:viewhiddenassigns' => array( 'captype' => 'read', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, @@ -417,7 +417,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_XSS | RISK_PERSONAL, 'captype' => 'read', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'editingteacher' => CAP_ALLOW, 'admin' => CAP_ALLOW @@ -685,7 +685,7 @@ $moodle_capabilities = array( 'moodle/blog:view' => array( 'captype' => 'read', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'guest' => CAP_ALLOW, 'user' => CAP_ALLOW, @@ -713,7 +713,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_SPAM, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, @@ -726,7 +726,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_SPAM, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'user' => CAP_ALLOW, 'admin' => CAP_ALLOW @@ -738,7 +738,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_SPAM, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, @@ -751,7 +751,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_SPAM, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, @@ -1157,7 +1157,7 @@ $moodle_capabilities = array( 'moodle/notes:view' => array( 'captype' => 'read', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, @@ -1169,7 +1169,7 @@ $moodle_capabilities = array( 'riskbitmask' => RISK_SPAM, 'captype' => 'write', - 'contextlevel' => CONTEXT_SYSTEM, + 'contextlevel' => CONTEXT_COURSE, 'legacy' => array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index 02529e45a2f..0e48422a907 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -3089,4 +3089,11 @@ function assignment_reset_course_form_defaults($course) { return array('reset_assignment_submissions'=>1); } +/** + * Returns all other caps used in module + */ +function assignment_get_extra_capabilities() { + return array('moodle/site:accessallgroups', 'moodle/site:viewfullnames'); +} + ?> diff --git a/mod/chat/lib.php b/mod/chat/lib.php index da5ab75284a..b0d0eb5ec28 100644 --- a/mod/chat/lib.php +++ b/mod/chat/lib.php @@ -812,4 +812,11 @@ function chat_reset_userdata($data) { return $status; } +/** + * Returns all other caps used in module + */ +function chat_get_extra_capabilities() { + return array('moodle/site:accessallgroups', 'moodle/site:viewfullnames'); +} + ?> diff --git a/mod/choice/lib.php b/mod/choice/lib.php index 17adb0d0246..8d9191918e0 100644 --- a/mod/choice/lib.php +++ b/mod/choice/lib.php @@ -740,6 +740,13 @@ function choice_get_response_data($choice, $cm, $groupmode) { } return $allresponses; - } + +/** + * Returns all other caps used in module + */ +function chice_get_extra_capabilities() { + return array('moodle/site:accessallgroups'); +} + ?> diff --git a/mod/data/lib.php b/mod/data/lib.php index e846a091a61..0bf97254cfe 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -2262,4 +2262,12 @@ function data_reset_userdata($data) { return $status; } + +/** + * Returns all other caps used in module + */ +function data_get_extra_capabilities() { + return array('moodle/site:accessallgroups', 'moodle/site:viewfullnames'); +} + ?> diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 10cb8bf1751..869187d89e6 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -6864,4 +6864,11 @@ function forum_get_open_modes() { '0' => get_string('openmode0', 'forum') ); } +/** + * Returns all other caps used in module + */ +function forum_get_extra_capabilities() { + return array('moodle/site:accessallgroups', 'moodle/site:viewfullnames', 'moodle/site:trustcontent'); +} + ?> diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index e09f7e40f9a..b070b0fd191 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -2299,4 +2299,11 @@ function glossary_reset_userdata($data) { return $status; } +/** + * Returns all other caps used in module + */ +function glossary_get_extra_capabilities() { + return array('moodle/site:accessallgroups', 'moodle/site:viewfullnames', 'moodle/site:trustcontent'); +} + ?> diff --git a/mod/hotpot/lib.php b/mod/hotpot/lib.php index fc3c5780839..6dbc93fd95d 100644 --- a/mod/hotpot/lib.php +++ b/mod/hotpot/lib.php @@ -2527,4 +2527,11 @@ END_OF_SCRIPT; } } +/** + * Returns all other caps used in module + */ +function hotpot_get_extra_capabilities() { + return array('moodle/site:accessallgroups'); +} + ?> diff --git a/mod/label/lib.php b/mod/label/lib.php index 847d9b31603..d6a89e0e983 100644 --- a/mod/label/lib.php +++ b/mod/label/lib.php @@ -128,4 +128,11 @@ function label_reset_userdata($data) { return array(); } +/** + * Returns all other caps used in module + */ +function lable_get_extra_capabilities() { + return array('moodle/site:accessallgroups'); +} + ?> diff --git a/mod/lesson/lib.php b/mod/lesson/lib.php index 333c4b81b8c..97704f62146 100644 --- a/mod/lesson/lib.php +++ b/mod/lesson/lib.php @@ -696,4 +696,11 @@ function lesson_reset_userdata($data) { return $status; } +/** + * Returns all other caps used in module + */ +function lesson_get_extra_capabilities() { + return array('moodle/site:accessallgroups'); +} + ?> diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index f427436a49d..0b310df59c8 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -1209,4 +1209,24 @@ function quiz_num_attempt_summary($quiz, $cm, $returnzero = false, $currentgroup } return ''; } + +/** + * Returns all other caps used in module + */ +function quiz_get_extra_capabilities() { + return array( + 'moodle/site:accessallgroups', + 'moodle/question:add', + 'moodle/question:editmine', + 'moodle/question:editall', + 'moodle/question:viewmine', + 'moodle/question:viewall', + 'moodle/question:usemine', + 'moodle/question:useall', + 'moodle/question:movemine', + 'moodle/question:moveall', + 'moodle/question:managecategory', + ); +} + ?> diff --git a/mod/resource/lib.php b/mod/resource/lib.php index d3193070269..82d5aad9246 100644 --- a/mod/resource/lib.php +++ b/mod/resource/lib.php @@ -673,4 +673,12 @@ function resource_delete_warning($course, $files) { function resource_reset_userdata($data) { return array(); } + +/** + * Returns all other caps used in module + */ +function resource_get_extra_capabilities() { + return array('moodle/site:accessallgroups'); +} + ?> diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index 769ab15ecf0..2c6e20f7a37 100755 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -626,4 +626,11 @@ function scorm_reset_userdata($data) { return $status; } +/** + * Returns all other caps used in module + */ +function scorm_get_extra_capabilities() { + return array('moodle/site:accessallgroups'); +} + ?> diff --git a/mod/survey/lib.php b/mod/survey/lib.php index 9a88fb92a7c..a3143dc22e4 100644 --- a/mod/survey/lib.php +++ b/mod/survey/lib.php @@ -581,4 +581,11 @@ function survey_reset_userdata($data) { return $status; } +/** + * Returns all other caps used in module + */ +function survey_get_extra_capabilities() { + return array('moodle/site:accessallgroups'); +} + ?> diff --git a/mod/wiki/lib.php b/mod/wiki/lib.php index 51a219dc3a7..a65a9b914ed 100644 --- a/mod/wiki/lib.php +++ b/mod/wiki/lib.php @@ -1757,5 +1757,11 @@ function wiki_release_lock($wikiid,$pagename) { } } +/** + * Returns all other caps used in module + */ +function wiki_get_extra_capabilities() { + return array('moodle/site:accessallgroups', 'moodle/site:viewfullnames'); +} ?> diff --git a/version.php b/version.php index 60227c57a3f..0dc2ebe9fec 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2008072402; // YYYYMMDD = date of the last version bump + $version = 2008072403; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 dev (Build: 20080724)'; // Human-friendly version name