mirror of
https://github.com/moodle/moodle.git
synced 2025-04-19 23:42:11 +02:00
MDL-63995 blocks: Remove unused capabilities and warning.
This commit is contained in:
parent
3271c39c74
commit
ef78cf8f42
@ -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';
|
||||
|
5
blocks/myoverview/upgrade.txt
Normal file
5
blocks/myoverview/upgrade.txt
Normal file
@ -0,0 +1,5 @@
|
||||
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.
|
@ -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';
|
5
blocks/recentlyaccessedcourses/upgrade.txt
Normal file
5
blocks/recentlyaccessedcourses/upgrade.txt
Normal file
@ -0,0 +1,5 @@
|
||||
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.
|
@ -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'
|
||||
)
|
||||
);
|
@ -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';
|
5
blocks/recentlyaccesseditems/upgrade.txt
Normal file
5
blocks/recentlyaccesseditems/upgrade.txt
Normal file
@ -0,0 +1,5 @@
|
||||
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.
|
@ -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';
|
5
blocks/starredcourses/upgrade.txt
Normal file
5
blocks/starredcourses/upgrade.txt
Normal file
@ -0,0 +1,5 @@
|
||||
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.
|
@ -23,6 +23,6 @@
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2018120300;
|
||||
$plugin->version = 2019022600;
|
||||
$plugin->requires = 2018112800;
|
||||
$plugin->component = 'block_starredcourses';
|
@ -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';
|
||||
|
5
blocks/timeline/upgrade.txt
Normal file
5
blocks/timeline/upgrade.txt
Normal file
@ -0,0 +1,5 @@
|
||||
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.
|
@ -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_timeline'; // Full name of the plugin (used for diagnostics).
|
||||
|
@ -1,6 +1,9 @@
|
||||
This files describes API changes in /blocks/* - activity modules,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 3.7 ===
|
||||
* The block:addinstance capability is no longer required if the block can only be added to a dashboard.
|
||||
|
||||
=== 3.6 ===
|
||||
|
||||
* The timeline view from block_myoverview has been split out into block_timeline.
|
||||
|
Loading…
x
Reference in New Issue
Block a user