MDL-14402 blocks: Do not show assign roles on my home

This commit is contained in:
Andrew Nicols 2014-11-19 10:22:02 +08:00
parent ca0e301c7b
commit 29ac5a6bce
2 changed files with 25 additions and 1 deletions

View file

@ -32,3 +32,27 @@ Feature: Add and configure blocks throughout the site
And I follow "Course 1" And I follow "Course 1"
# The first block matching the pattern should be top-left block # The first block matching the pattern should be top-left block
And I should see "Comments" in the "//*[@id='region-pre' or @id='block-region-side-pre']/descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' block ')]" "xpath_element" And I should see "Comments" in the "//*[@id='region-pre' or @id='block-region-side-pre']/descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' block ')]" "xpath_element"
Scenario: Blocks on the my home page cannot have roles assigned to them
Given the following "users" exist:
| username | firstname | lastname | email |
| manager1 | Manager | 1 | manager1@asd.com |
And I log in as "manager1"
And I click on "My home" "link" in the "Navigation" "block"
When I press "Customise this page"
Then I should not see "Assign roles in Navigation block"
Scenario: Blocks on courses can have roles assigned to them
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | teacher | 1 | teacher@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Turn editing on"
Then I should see "Assign roles in Search forums block"

View file

@ -1082,7 +1082,7 @@ class block_manager {
} }
// Assign roles icon. // Assign roles icon.
if (has_capability('moodle/role:assign', $block->context)) { if ($this->page->pagetype != 'my-index' && has_capability('moodle/role:assign', $block->context)) {
//TODO: please note it is sloppy to pass urls through page parameters!! //TODO: please note it is sloppy to pass urls through page parameters!!
// it is shortened because some web servers (e.g. IIS by default) give // it is shortened because some web servers (e.g. IIS by default) give
// a 'security' error if you try to pass a full URL as a GET parameter in another URL. // a 'security' error if you try to pass a full URL as a GET parameter in another URL.