Skip to content

Commit

Permalink
MDL-56581 Roles: Permissions override screen not inherited styling
Browse files Browse the repository at this point in the history
  • Loading branch information
jesackland-snow authored and danpoltawski committed Dec 20, 2016
1 parent 863e1a6 commit e985a29
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
18 changes: 18 additions & 0 deletions admin/roles/classes/override_permissions_table_advanced.php
Expand Up @@ -56,6 +56,24 @@ public function __construct($context, $roleid, $safeoverridesonly) {
}
}

/**
* 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();
Expand Down
23 changes: 23 additions & 0 deletions admin/roles/tests/behat/override_roles_highlighting.feature
@@ -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"
4 changes: 4 additions & 0 deletions theme/bootstrapbase/less/moodle/admin.less
Expand Up @@ -850,3 +850,7 @@ img.iconsmall {
color: @infoText;
background-color: @infoBackground;
}

#overriderolestable .overriddenpermission {
background-color: @warningBackground;
}
3 changes: 3 additions & 0 deletions theme/bootstrapbase/style/moodle.css
Expand Up @@ -3234,6 +3234,9 @@ img.iconsmall {
color: #3a87ad;
background-color: #d9edf7;
}
#overriderolestable .overriddenpermission {
background-color: #fcf8e3;
}
/* calendar.less */
.calendar_event_course {
background-color: #ffd3bd;
Expand Down

0 comments on commit e985a29

Please sign in to comment.