mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 12:45:04 +01:00
Merge branch 'MDL-51702_master' of git://github.com/dmonllao/moodle
This commit is contained in:
commit
1d1c8f6275
@ -48,11 +48,11 @@ Feature: Add and configure blocks throughout the site
|
||||
# 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: Blocks on the dashboard page cannot have roles assigned to them
|
||||
Scenario: Blocks on the dashboard page can have roles assigned to them
|
||||
Given I log in as "manager1"
|
||||
And I click on "Dashboard" "link" in the "Navigation" "block"
|
||||
When I press "Customise this page"
|
||||
Then I should not see "Assign roles in Navigation block"
|
||||
Then I should see "Assign roles in Navigation block"
|
||||
|
||||
Scenario: Blocks on courses can have roles assigned to them
|
||||
Given I log in as "teacher1"
|
||||
|
@ -1093,38 +1093,36 @@ class block_manager {
|
||||
}
|
||||
|
||||
// Display either "Assign roles" or "Permissions" or "Change permissions" icon (whichever first is available).
|
||||
if ($this->page->pagetype != 'my-index') {
|
||||
$rolesurl = null;
|
||||
$rolesurl = null;
|
||||
|
||||
if (get_assignable_roles($block->context, ROLENAME_SHORT)) {
|
||||
$rolesurl = new moodle_url('/admin/roles/assign.php', array('contextid' => $block->context->id));
|
||||
$str = new lang_string('assignrolesinblock', 'block', $blocktitle);
|
||||
$icon = 'i/assignroles';
|
||||
} else if (has_capability('moodle/role:review', $block->context) or get_overridable_roles($block->context)) {
|
||||
$rolesurl = new moodle_url('/admin/roles/permissions.php', array('contextid' => $block->context->id));
|
||||
$str = get_string('permissions', 'role');
|
||||
$icon = 'i/permissions';
|
||||
} else if (has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride', 'moodle/role:override', 'moodle/role:assign'), $block->context)) {
|
||||
$rolesurl = new moodle_url('/admin/roles/check.php', array('contextid' => $block->context->id));
|
||||
$str = get_string('checkpermissions', 'role');
|
||||
$icon = 'i/checkpermissions';
|
||||
}
|
||||
if (get_assignable_roles($block->context, ROLENAME_SHORT)) {
|
||||
$rolesurl = new moodle_url('/admin/roles/assign.php', array('contextid' => $block->context->id));
|
||||
$str = new lang_string('assignrolesinblock', 'block', $blocktitle);
|
||||
$icon = 'i/assignroles';
|
||||
} else if (has_capability('moodle/role:review', $block->context) or get_overridable_roles($block->context)) {
|
||||
$rolesurl = new moodle_url('/admin/roles/permissions.php', array('contextid' => $block->context->id));
|
||||
$str = get_string('permissions', 'role');
|
||||
$icon = 'i/permissions';
|
||||
} else if (has_any_capability(array('moodle/role:safeoverride', 'moodle/role:override', 'moodle/role:assign'), $block->context)) {
|
||||
$rolesurl = new moodle_url('/admin/roles/check.php', array('contextid' => $block->context->id));
|
||||
$str = get_string('checkpermissions', 'role');
|
||||
$icon = 'i/checkpermissions';
|
||||
}
|
||||
|
||||
if ($rolesurl) {
|
||||
//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.
|
||||
$return = $this->page->url->out(false);
|
||||
$return = str_replace($CFG->wwwroot . '/', '', $return);
|
||||
$rolesurl->param('returnurl', $return);
|
||||
if ($rolesurl) {
|
||||
// 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.
|
||||
$return = $this->page->url->out(false);
|
||||
$return = str_replace($CFG->wwwroot . '/', '', $return);
|
||||
$rolesurl->param('returnurl', $return);
|
||||
|
||||
$controls[] = new action_menu_link_secondary(
|
||||
$rolesurl,
|
||||
new pix_icon($icon, $str, 'moodle', array('class' => 'iconsmall', 'title' => '')),
|
||||
$str,
|
||||
array('class' => 'editing_roles')
|
||||
);
|
||||
}
|
||||
$controls[] = new action_menu_link_secondary(
|
||||
$rolesurl,
|
||||
new pix_icon($icon, $str, 'moodle', array('class' => 'iconsmall', 'title' => '')),
|
||||
$str,
|
||||
array('class' => 'editing_roles')
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->user_can_delete_block($block)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user