Rather than performing complicated upgrade procedures from the old (broken) logic in three activity modules, we are adding new capabilities to those three modules to make them all consistent, and using them in a callback from the Ratings API. This is the same as the Comments API.
The downside is that two sets of capabilities need to be enabled for ratings to work. Hopefully this can be mitigated somewhat when build some sort of shortcuts on the module settings forms to set capabilities. In the meantime, the effect is reduced somewhat by having all the rating capabilities enabled by default for student and teacher roles. This means control is in the hands of whatever the modules have set, giving very close backward compatibility.
This is not the perfect solution, but neither were the other two.
'manager' => CAP_ALLOW
)
),
+ 'moodle/rating:viewany' => array(
+ 'riskbitmask' => RISK_PERSONAL,
+ 'captype' => 'read',
+ 'contextlevel' => CONTEXT_SYSTEM,
+ 'legacy' => array(
+ 'student' => CAP_ALLOW,
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'manager' => CAP_ALLOW
+ )
+ ),
'moodle/rating:viewall' => array(
-
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
+ 'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
+ 'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
)
),
+ 'mod/data:rate' => array(
+
+ 'captype' => 'write',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'manager' => CAP_ALLOW
+ )
+ ),
+
'mod/data:viewrating' => array(
'captype' => 'read',
)
),
- 'mod/data:rate' => array(
+ 'mod/data:viewanyrating' => array(
- 'captype' => 'write',
+ 'riskbitmask' => RISK_PERSONAL,
+ 'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
- )
+ ),
+ 'clonepermissionsfrom' => 'mod/data:viewrating'
+ ),
+
+ 'mod/data:viewallratings' => array(
+
+ 'riskbitmask' => RISK_PERSONAL,
+ 'captype' => 'read',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'manager' => CAP_ALLOW
+ ),
+ 'clonepermissionsfrom' => 'mod/data:viewrating'
),
'mod/data:approve' => array(
$string['data:rate'] = 'Rate entries';
$string['data:readentry'] = 'Read entries';
$string['data:viewalluserpresets'] = 'View presets from all users';
+$string['data:viewallratings'] = 'View all raw ratings given by individuals';
+$string['data:viewanyrating'] = 'View total ratings that anyone received';
$string['data:viewentry'] = 'View entries';
-$string['data:viewrating'] = 'View ratings';
+$string['data:viewrating'] = 'View the total rating you received';
$string['data:writeentry'] = 'Write entries';
$string['date'] = 'Date';
$string['dateentered'] = 'Date entered';
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2010041300;
-$module->requires = 2010041300; // Requires this Moodle version
+$module->version = 2010042300;
+$module->requires = 2010042300; // Requires this Moodle version
$module->cron = 60;
'mod/forum:viewanyrating' => array(
+ 'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
)
),
+ 'mod/forum:viewallratings' => array(
+
+ 'riskbitmask' => RISK_PERSONAL,
+ 'captype' => 'read',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'manager' => CAP_ALLOW
+ ),
+ 'clonepermissionsfrom' => 'mod/forum:viewanyrating'
+ ),
+
'mod/forum:rate' => array(
'captype' => 'write',
$string['forumtracked'] = 'Unread posts are being tracked';
$string['forumtrackednot'] = 'Unread posts are not being tracked';
$string['forumtype'] = 'Forum type';
-$string['forum:viewanyrating'] = 'View any ratings';
+$string['forum:viewallratings'] = 'View all raw ratings given by individuals';
+$string['forum:viewanyrating'] = 'View total ratings that anyone received';
$string['forum:viewdiscussion'] = 'View discussions';
$string['forum:viewhiddentimedposts'] = 'View hidden timed posts';
$string['forum:viewqandawithoutposting'] = 'Always see Q and A posts';
-$string['forum:viewrating'] = 'View ratings';
+$string['forum:viewrating'] = 'View the total rating you received';
$string['forum:viewsubscribers'] = 'View subscribers';
$string['generalforum'] = 'Standard forum for general use';
$string['generalforums'] = 'General forums';
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$module->version = 2010042200;
-$module->requires = 2010042200; // Requires this Moodle version
+$module->version = 2010042300;
+$module->requires = 2010042300; // Requires this Moodle version
$module->cron = 60;
)
),
+ 'mod/glossary:viewanyrating' => array(
+
+ 'riskbitmask' => RISK_PERSONAL,
+ 'captype' => 'read',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'manager' => CAP_ALLOW
+ ),
+ 'clonepermissionsfrom' => 'mod/glossary:viewrating'
+ ),
+
+ 'mod/glossary:viewallratings' => array(
+
+ 'riskbitmask' => RISK_PERSONAL,
+ 'captype' => 'read',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'manager' => CAP_ALLOW
+ ),
+ 'clonepermissionsfrom' => 'mod/glossary:viewrating'
+ ),
+
'mod/glossary:exportentry' => array(
'riskbitmask' => RISK_PERSONAL,
$string['glossary:rate'] = 'Rate entries';
$string['glossarytype'] = 'Glossary Type';
$string['glossary:view'] = 'View glossary';
-$string['glossary:viewrating'] = 'View ratings';
+$string['glossary:viewallratings'] = 'View all raw ratings given by individuals';
+$string['glossary:viewanyrating'] = 'View total ratings that anyone received';
+$string['glossary:viewrating'] = 'View the total rating you received';
$string['glossary:write'] = 'Create new entries';
$string['guestnoedit'] = 'Guests are not allowed to edit glossaries';
$string['changeto'] = 'change to {$a}';
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2010042200;
-$module->requires = 2010042200; // Requires this Moodle version
+$module->version = 2010042300;
+$module->requires = 2010042300; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2010042200; // YYYYMMDD = date of the last version bump
+ $version = 2010042300; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20100423)'; // Human-friendly version name