MDL-40289 fix all badges capabilities
1/ contextlevel must be the lowest level where capability can be overriden 2/ coursecreator is for course creation only!!! 3/ do not mix user with other archetypes 4/ config risk is for admin actions only in standard install No upgrade cleanup, sorry, blame integrators...
This commit is contained in:
+15
-25
@@ -1892,19 +1892,17 @@ $capabilities = array(
|
||||
// View available badges without earning them.
|
||||
'moodle/badges:viewbadges' => array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'archetypes' => array(
|
||||
'manager' => CAP_ALLOW,
|
||||
'user' => CAP_ALLOW,
|
||||
'student' => CAP_ALLOW
|
||||
)
|
||||
),
|
||||
|
||||
// Manage badges on own private badges page.
|
||||
'moodle/badges:manageownbadges' => array(
|
||||
'riskbitmap' => RISK_SPAM | RISK_PERSONAL,
|
||||
'riskbitmap' => RISK_SPAM,
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'contextlevel' => CONTEXT_USER,
|
||||
'archetypes' => array(
|
||||
'user' => CAP_ALLOW
|
||||
)
|
||||
@@ -1923,69 +1921,62 @@ $capabilities = array(
|
||||
// Earn badge.
|
||||
'moodle/badges:earnbadge' => array(
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'archetypes' => array(
|
||||
'user' => CAP_ALLOW,
|
||||
'student' => CAP_ALLOW,
|
||||
)
|
||||
),
|
||||
|
||||
// Create/duplicate badges.
|
||||
'moodle/badges:createbadge' => array(
|
||||
'riskbitmask' => RISK_CONFIG | RISK_SPAM,
|
||||
'riskbitmask' => RISK_SPAM,
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'archetypes' => array(
|
||||
'manager' => CAP_ALLOW,
|
||||
'coursecreator' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
)
|
||||
),
|
||||
|
||||
// Delete badges.
|
||||
'moodle/badges:deletebadge' => array(
|
||||
'riskbitmask' => RISK_CONFIG | RISK_DATALOSS,
|
||||
'riskbitmask' => RISK_DATALOSS,
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'archetypes' => array(
|
||||
'manager' => CAP_ALLOW,
|
||||
'coursecreator' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
)
|
||||
),
|
||||
|
||||
// Set up/edit badge details.
|
||||
'moodle/badges:configuredetails' => array(
|
||||
'riskbitmask' => RISK_CONFIG,
|
||||
'riskbitmask' => RISK_SPAM,
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'archetypes' => array(
|
||||
'manager' => CAP_ALLOW,
|
||||
'coursecreator' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
)
|
||||
),
|
||||
|
||||
// Set up/edit criteria of earning a badge.
|
||||
'moodle/badges:configurecriteria' => array(
|
||||
'riskbitmask' => RISK_CONFIG,
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'archetypes' => array(
|
||||
'manager' => CAP_ALLOW,
|
||||
'coursecreator' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
)
|
||||
),
|
||||
|
||||
// Configure badge messages.
|
||||
'moodle/badges:configuremessages' => array(
|
||||
'riskbitmask' => RISK_CONFIG,
|
||||
'riskbitmask' => RISK_SPAM,
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'archetypes' => array(
|
||||
'manager' => CAP_ALLOW,
|
||||
'coursecreator' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
)
|
||||
),
|
||||
@@ -1994,10 +1985,9 @@ $capabilities = array(
|
||||
'moodle/badges:awardbadge' => array(
|
||||
'riskbitmask' => RISK_SPAM,
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'archetypes' => array(
|
||||
'manager' => CAP_ALLOW,
|
||||
'coursecreator' => CAP_ALLOW,
|
||||
'teacher' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
)
|
||||
@@ -2007,7 +1997,7 @@ $capabilities = array(
|
||||
'moodle/badges:viewawarded' => array(
|
||||
'riskbitmask' => RISK_PERSONAL,
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'archetypes' => array(
|
||||
'manager' => CAP_ALLOW,
|
||||
'teacher' => CAP_ALLOW,
|
||||
|
||||
Reference in New Issue
Block a user