Permalink
Browse files

MDL-36864 blocks: only perform myaddinstance capability check on the …

…My Moodle page, not on any other pages using the user context
  • Loading branch information...
1 parent f42c34a commit 9b06b5071977af693574e04a5e031b5776fa03b3 @markn86 markn86 committed Nov 28, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 blocks/moodleblock.class.php
@@ -565,7 +565,8 @@ function user_can_addto($page) {
// 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
- && $page->context->instanceid == $USER->id) { // Page belongs to this user
+ && $page->context->instanceid == $USER->id // Page belongs to this user
+ && $page->pagetype == 'my-index') { // Ensure we are on the My Moodle page
$capability = 'block/' . $this->name() . ':myaddinstance';
return $this->has_add_block_capability($page, $capability)
&& has_capability('moodle/my:manageblocks', $page->context);

0 comments on commit 9b06b50

Please sign in to comment.