Merge branch 'MDL-63643-master' of git://github.com/lameze/moodle

This commit is contained in:
Jun Pataleta 2019-06-05 15:43:35 +08:00
commit 9e5dc79f38
3 changed files with 33 additions and 7 deletions

View File

@ -6,11 +6,11 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
Background:
Given the following "users" exist:
| username | firstname | lastname | email | auth | confirmed |
| user1 | User | One | one@example.com | manual | 0 |
| user2 | User | Two | two@example.com | ldap | 1 |
| user3 | User | Three | three@example.com | manual | 1 |
| user4 | User | Four | four@example.com | ldap | 0 |
| username | firstname | lastname | email | auth | confirmed | lastip |
| user1 | User | One | one@example.com | manual | 0 | 127.0.1.1 |
| user2 | User | Two | two@example.com | ldap | 1 | 0.0.0.0 |
| user3 | User | Three | three@example.com | manual | 1 | 0.0.0.0 |
| user4 | User | Four | four@example.com | ldap | 0 | 127.0.1.2 |
And the following "cohorts" exist:
| name | idnumber |
| Cohort 1 | CH1 |
@ -82,3 +82,25 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
And I should not see "User Two"
And I should not see "User Three"
And I should see "User Four"
Scenario: Filter user accounts by last IP address
When I set the following fields to these values:
| id_lastip | 127.0.1.1 |
And I press "Add filter"
Then I should see "User One"
And I should not see "User Two"
And I should not see "User Three"
And I should not see "User Four"
And I press "Remove all filters"
And I set the following fields to these values:
| id_lastip | 127.0.1.2 |
And I press "Add filter"
And I should not see "User One"
And I should not see "User Two"
And I should not see "User Three"
And I should see "User Four"
And I press "Remove all filters"
And I should see "User One"
And I should see "User Two"
And I should see "User Three"
And I should see "User Four"

View File

@ -253,7 +253,10 @@ EOD;
}
$record['timemodified'] = $record['timecreated'];
$record['lastip'] = '0.0.0.0';
if (!isset($record['lastip'])) {
$record['lastip'] = '0.0.0.0';
}
if ($record['deleted']) {
$delname = $record['email'].'.'.time();

View File

@ -68,7 +68,7 @@ class user_filtering {
'country' => 1, 'confirmed' => 1, 'suspended' => 1, 'profile' => 1, 'courserole' => 1,
'anycourses' => 1, 'systemrole' => 1, 'cohort' => 1, 'firstaccess' => 1, 'lastaccess' => 1,
'neveraccessed' => 1, 'timemodified' => 1, 'nevermodified' => 1, 'auth' => 1, 'mnethostid' => 1,
'idnumber' => 1);
'idnumber' => 1, 'lastip' => 1);
}
$this->_fields = array();
@ -154,6 +154,7 @@ class user_filtering {
case 'nevermodified': return new user_filter_checkbox('nevermodified', get_string('nevermodified', 'filters'), $advanced, array('timemodified', 'timecreated'), array('timemodified_sck', 'timemodified_eck'));
case 'cohort': return new user_filter_cohort($advanced);
case 'idnumber': return new user_filter_text('idnumber', get_string('idnumber'), $advanced, 'idnumber');
case 'lastip': return new user_filter_text('lastip', get_string('lastip'), $advanced, 'lastip');
case 'auth':
$plugins = core_component::get_plugin_list('auth');
$choices = array();