Skip to content

Commit

Permalink
MDL-14402 blocks: Do not show assign roles on my home
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Nov 19, 2014
1 parent 7bc338e commit 49f7f2e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions blocks/tests/behat/configure_block_throughout_site.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,27 @@ Feature: Add and configure blocks throughout the site
And I follow "Course 1"
# 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"

Scenario: My home does not allow assignation of roles on blocks
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"
2 changes: 1 addition & 1 deletion lib/blocklib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ public function edit_controls($block) {
}

// 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!!
// 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.
Expand Down

0 comments on commit 49f7f2e

Please sign in to comment.