mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-51078 report_log: Allow filtering by all changes
This commit is contained in:
parent
d1a3ea62ef
commit
7c4dfba89e
@ -282,7 +282,7 @@ class report_log_renderable implements renderable {
|
|||||||
'r' => get_string('view'),
|
'r' => get_string('view'),
|
||||||
'u' => get_string('update'),
|
'u' => get_string('update'),
|
||||||
'd' => get_string('delete'),
|
'd' => get_string('delete'),
|
||||||
'' => get_string('allchanges')
|
'cud' => get_string('allchanges')
|
||||||
);
|
);
|
||||||
return $actions;
|
return $actions;
|
||||||
}
|
}
|
||||||
|
@ -380,8 +380,9 @@ class report_log_table_log extends table_sql {
|
|||||||
$params['action'] = '%'.$action.'%';
|
$params['action'] = '%'.$action.'%';
|
||||||
}
|
}
|
||||||
} else if (!empty($this->filterparams->action)) {
|
} else if (!empty($this->filterparams->action)) {
|
||||||
$sql = "crud = :crud";
|
list($sql, $params) = $DB->get_in_or_equal(preg_split('//', $this->filterparams->action),
|
||||||
$params['crud'] = $this->filterparams->action;
|
SQL_PARAMS_NAMED, 'crud');
|
||||||
|
$sql = "crud " . $sql;
|
||||||
} else {
|
} else {
|
||||||
// Add condition for all possible values of crud (to use db index).
|
// 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'),
|
list($sql, $params) = $DB->get_in_or_equal(array('c', 'r', 'u', 'd'),
|
||||||
|
88
report/log/tests/behat/filter_log_actions.feature
Normal file
88
report/log/tests/behat/filter_log_actions.feature
Normal 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."
|
Loading…
x
Reference in New Issue
Block a user