MDL-56581 Roles: Permissions override screen not inherited styling

This commit is contained in:
Jes Ackland-Snow 2016-10-20 17:52:33 +02:00 committed by Dan Poltawski
parent 863e1a66a9
commit e985a29cdf
4 changed files with 48 additions and 0 deletions

View File

@ -56,6 +56,24 @@ class core_role_override_permissions_table_advanced extends core_role_capability
}
}
/**
* This method adds an additional class to a row if capability is other than inherited.
*
* @param stdClass $capability
* @return array
*/
protected function get_row_attributes($capability) {
$rowattributes = parent::get_row_attributes($capability);
if ($this->permissions[$capability->name] !== 0) {
if (empty($rowattributes['class'])) {
$rowattributes['class'] = "overriddenpermission";
} else {
$rowattributes['class'] .= " overriddenpermission";
}
}
return $rowattributes;
}
protected function load_parent_permissions() {
// Get the capabilities from the parent context, so that can be shown in the interface.
$parentcontext = $this->context->get_parent_context();

View File

@ -0,0 +1,23 @@
@core @core_admin @core_admin_roles
Feature: Highlight non-inherited permissions
In order that the status of capabilities can be more easily seen
As an admin
I need altered permissions to be highlighted
Background:
Given the following "courses" exist:
| fullname | shortname |
| Course fullname | C_shortname |
And I log in as "admin"
And I am on site homepage
@javascript
Scenario: Override a permission
Given I follow "Course fullname"
When I expand "Users" node
And I follow "Permissions"
And I select "1" from the "roleid" singleselect
And I click on "Prohibit" "radio" in the "View added and updated modules in recent activity block" "table_row"
And I press "Save changes"
And I select "1" from the "roleid" singleselect
Then the "class" attribute of "View added and updated modules in recent activity block" "table_row" should contain "overriddenpermission"

View File

@ -850,3 +850,7 @@ img.iconsmall {
color: @infoText;
background-color: @infoBackground;
}
#overriderolestable .overriddenpermission {
background-color: @warningBackground;
}

View File

@ -3234,6 +3234,9 @@ img.iconsmall {
color: #3a87ad;
background-color: #d9edf7;
}
#overriderolestable .overriddenpermission {
background-color: #fcf8e3;
}
/* calendar.less */
.calendar_event_course {
background-color: #ffd3bd;