Merge branch 'MDL-51078_m32v3' of https://github.com/sbourget/moodle

This commit is contained in:
Dan Poltawski 2016-08-09 08:57:09 +01:00
commit 4d31fc8444
3 changed files with 92 additions and 3 deletions

View File

@ -286,7 +286,7 @@ class report_log_renderable implements renderable {
'r' => get_string('view'),
'u' => get_string('update'),
'd' => get_string('delete'),
'' => get_string('allchanges')
'cud' => get_string('allchanges')
);
return $actions;
}

View File

@ -380,8 +380,9 @@ class report_log_table_log extends table_sql {
$params['action'] = '%'.$action.'%';
}
} else if (!empty($this->filterparams->action)) {
$sql = "crud = :crud";
$params['crud'] = $this->filterparams->action;
list($sql, $params) = $DB->get_in_or_equal(preg_split('//', $this->filterparams->action),
SQL_PARAMS_NAMED, 'crud');
$sql = "crud " . $sql;
} else {
// Add condition for all possible values of crud (to use db index).
list($sql, $params) = $DB->get_in_or_equal(array('c', 'r', 'u', 'd'),

View File

@ -0,0 +1,88 @@
@report @report_log
Feature: In a report, admin can filter log data by action
In order to filter log data by action
As an admin
I need to view the logs and apply a filter
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I turn editing mode on
# Create Action.
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 1 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I follow "Course 1"
# View Action.
And I follow "Test assignment 1"
# Update Action.
And I navigate to "Edit settings" node in "Assignment administration"
And I press "Save and return to course"
# Delete Action.
And I delete "Test assignment 1" activity
And I log out
Scenario: View only create actions.
Given I log in as "admin"
When I navigate to "Logs" node in "Site administration > Reports"
And I set the field "menumodaction" to "Create"
And I press "Get these logs"
Then I should see "Course module created"
And I should not see "Course module updated"
And I should not see "The status of the submission has been viewed."
And I should not see "Course module deleted"
Scenario: View only update actions.
Given I log in as "admin"
When I navigate to "Logs" node in "Site administration > Reports"
And I set the field "menumodaction" to "Update"
And I press "Get these logs"
Then I should see "Course module updated"
And I should not see "Course module created"
And I should not see "The status of the submission has been viewed."
And I should not see "Course module deleted"
Scenario: View only view actions.
Given I log in as "admin"
When I navigate to "Logs" node in "Site administration > Reports"
And I set the field "menumodaction" to "View"
And I press "Get these logs"
Then I should see "The status of the submission has been viewed."
And I should not see "Course module created"
And I should not see "Course module updated"
And I should not see "Course module deleted"
Scenario: View only delete actions.
Given I log in as "admin"
When I navigate to "Logs" node in "Site administration > Reports"
And I set the field "menumodaction" to "Delete"
And I press "Get these logs"
Then I should see "Course module deleted"
And I should not see "Course module created"
And I should not see "Course module updated"
And I should not see "The status of the submission has been viewed."
Scenario: View only changes.
Given I log in as "admin"
When I navigate to "Logs" node in "Site administration > Reports"
And I set the field "menumodaction" to "All changes"
And I press "Get these logs"
Then I should see "Course module deleted"
And I should see "Course module created"
And I should see "Course module updated"
And I should not see "The status of the submission has been viewed."
Scenario: View all actions.
Given I log in as "admin"
When I navigate to "Logs" node in "Site administration > Reports"
And I set the field "menumodaction" to "All actions"
And I press "Get these logs"
Then I should see "Course module deleted"
And I should see "Course module created"
And I should see "Course module updated"
And I should see "The status of the submission has been viewed."