Commit ef78cf8f authored by Dan Marsden's avatar Dan Marsden
Browse files

MDL-63995 blocks: Remove unused capabilities and warning.

parent 3271c39c
......@@ -580,6 +580,9 @@ class block_base {
function user_can_addto($page) {
global $USER;
// List of formats this block supports.
$formats = $this->applicable_formats();
// The blocks in My Moodle are a special case and use a different capability.
if (!empty($USER->id)
&& $page->context->contextlevel == CONTEXT_USER // Page belongs to a user
......@@ -587,7 +590,6 @@ class block_base {
&& $page->pagetype == 'my-index') { // Ensure we are on the My Moodle page
// If the block cannot be displayed on /my it is ok if the myaddinstance capability is not defined.
$formats = $this->applicable_formats();
// Is 'my' explicitly forbidden?
// If 'all' has not been allowed, has 'my' been explicitly allowed?
if ((isset($formats['my']) && $formats['my'] == false)
......@@ -601,6 +603,12 @@ class block_base {
&& has_capability('moodle/my:manageblocks', $page->context);
}
}
// Check if this is a block only used on /my.
unset($formats['my']);
if (empty($formats)) {
// Block can only be added to /my - return false.
return false;
}
$capability = 'block/' . $this->name() . ':addinstance';
if ($this->has_add_block_capability($page, $capability)
......
......@@ -34,17 +34,5 @@ $capabilities = array(
),
'clonepermissionsfrom' => 'moodle/my:manageblocks'
),
'block/myoverview:addinstance' => array(
'riskbitmask' => RISK_SPAM | RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:manageblocks'
)
);
......@@ -54,7 +54,6 @@ $string['future'] = 'Future';
$string['inprogress'] = 'In progress';
$string['lastaccessed'] = 'Last accessed';
$string['list'] = 'List';
$string['myoverview:addinstance'] = 'Add a new course overview block';
$string['myoverview:myaddinstance'] = 'Add a new course overview block to Dashboard';
$string['past'] = 'Past';
$string['pluginname'] = 'Course overview';
......
This file describes API changes in the myoverview block code.
=== 3.7 ===
* The 'block/myoverview:addinstance' capability has been removed. It has never been used in code.
\ No newline at end of file
......@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2018120300; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2019022600; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2018112800; // Requires this Moodle version.
$plugin->component = 'block_myoverview'; // Full name of the plugin (used for diagnostics).
......@@ -34,15 +34,5 @@ $capabilities = array(
),
'clonepermissionsfrom' => 'moodle/my:manageblocks'
),
'block/recentlyaccessedcourses:addinstance' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:manageblocks'
)
);
......@@ -22,6 +22,5 @@
*/
$string['pluginname'] = 'Recently accessed courses';
$string['privacy:metadata'] = 'The Recently accessed courses block does not store any personal data.';
$string['recentlyaccessedcourses:addinstance'] = 'Add a new Recently accessed courses block';
$string['recentlyaccessedcourses:myaddinstance'] = 'Add a new recently accessed courses block to Dashboard';
$string['nocourses'] = 'No recent courses';
\ No newline at end of file
This file describes API changes in the recentlyaccesscourses block code.
=== 3.7 ===
* The 'block/recentlyaccesscourses:addinstance' capability has been removed. It has never been used in code.
\ No newline at end of file
......@@ -22,6 +22,6 @@
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2018120300; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2019022600; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2018112800; // Requires this Moodle version.
$plugin->component = 'block_recentlyaccessedcourses'; // Full name of the plugin (used for diagnostics).
......@@ -29,13 +29,5 @@ $capabilities = array(
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/my:manageblocks'
),
'block/recentlyaccesseditems:addinstance' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:manageblocks'
)
);
\ No newline at end of file
......@@ -28,5 +28,4 @@ $string['privacy:metadata:block_recentlyaccesseditemstablesummary'] = 'The Recen
$string['privacy:metadata:timeaccess'] = 'The time when the user last accessed the item';
$string['privacy:metadata:userid'] = 'The ID of the user who accessed the item';
$string['privacy:recentlyaccesseditemspath'] = 'Recently accessed items';
$string['recentlyaccesseditems:addinstance'] = 'Add a new recently accessed items block';
$string['recentlyaccesseditems:myaddinstance'] = 'Add a new recently accessed items block to Dashboard';
\ No newline at end of file
This file describes API changes in the recentlyaccesseditems block code.
=== 3.7 ===
* The 'block/recentlyaccesseditems:addinstance' capability has been removed. It has never been used in code.
\ No newline at end of file
......@@ -22,6 +22,6 @@
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2018120301; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2019022600; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2018112800; // Requires this Moodle version.
$plugin->component = 'block_recentlyaccesseditems'; // Full name of the plugin (used for diagnostics).
......@@ -34,15 +34,5 @@ $capabilities = array(
),
'clonepermissionsfrom' => 'moodle/my:manageblocks'
),
'block/starredcourses:addinstance' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:manageblocks'
),
)
);
......@@ -24,6 +24,5 @@
$string['pluginname'] = 'Starred courses';
$string['privacy:metadata'] = 'The starred courses block does not store any personal data.';
$string['starredcourses:addinstance'] = 'Add a new starred courses block';
$string['starredcourses:myaddinstance'] = 'Add a new starred courses block to Dashboard';
$string['nocourses'] = 'No starred courses';
\ No newline at end of file
This file describes API changes in the starredcourses block code.
=== 3.7 ===
* The 'block/starredcourses:addinstance' capability has been removed. It has never been used in code.
\ No newline at end of file
......@@ -23,6 +23,6 @@
*/
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2018120300;
$plugin->version = 2019022600;
$plugin->requires = 2018112800;
$plugin->component = 'block_starredcourses';
\ No newline at end of file
......@@ -34,17 +34,5 @@ $capabilities = array(
),
'clonepermissionsfrom' => 'moodle/my:manageblocks'
),
'block/timeline:addinstance' => array(
'riskbitmask' => RISK_SPAM | RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:manageblocks'
)
);
......@@ -32,7 +32,6 @@ $string['ariaviewselector'] = 'Sort timeline items';
$string['ariaviewselectoroption'] = '{$a} sort option';
$string['duedate'] = 'Due date';
$string['morecourses'] = 'More courses';
$string['timeline:addinstance'] = 'Add a new timeline block';
$string['timeline:myaddinstance'] = 'Add a new timeline block to Dashboard';
$string['nocoursesinprogress'] = 'No in-progress courses';
$string['noevents'] = 'No upcoming activities due';
......
This file describes API changes in the timeline block code.
=== 3.7 ===
* The 'block/timeline:addinstance' capability has been removed. It has never been used in code.
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment