This commit is contained in:
Dan Poltawski 2015-02-24 11:51:44 +00:00
commit 94e4ca4cca
2 changed files with 66 additions and 1 deletions

View File

@ -66,7 +66,7 @@ class user_filtering {
$fieldnames = array('realname' => 0, 'lastname' => 1, 'firstname' => 1, 'username' => 1, 'email' => 1, 'city' => 1, 'country' => 1,
'confirmed' => 1, 'suspended' => 1, 'profile' => 1, 'courserole' => 1, 'systemrole' => 1,
'cohort' => 1, 'firstaccess' => 1, 'lastaccess' => 1, 'neveraccessed' => 1, 'timemodified' => 1,
'nevermodified' => 1, 'auth' => 1, 'mnethostid' => 1);
'nevermodified' => 1, 'auth' => 1, 'mnethostid' => 1, 'idnumber' => 1);
}
$this->_fields = array();
@ -149,6 +149,7 @@ class user_filtering {
case 'timemodified': return new user_filter_date('timemodified', get_string('lastmodified'), $advanced, 'timemodified');
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 'auth':
$plugins = core_component::get_plugin_list('auth');
$choices = array();

View File

@ -0,0 +1,64 @@
@core @core_user
Feature: Filter users by idnumber
As a system administrator
I need to be able to filter users by their ID number
So that I can quickly find users based on an external key.
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher@asd.com | 0000002 |
| student1 | Student1 | 1 | student1@asd.com | 0000003 |
| student2 | Student2 | 1 | student2@asd.com | 2000000 |
| student3 | Student3 | 1 | student3@asd.com | 3000000 |
And I log in as "admin"
And I expand "Site administration" node
# Front page settings also has a "Users" node.
And I expand "Users" node
And I expand "Users" node
And I expand "Accounts" node
When I follow "Browse list of users"
@javascript
Scenario: Filtering id numbers - with case "is empty"
# We should see see admin on the user list, the following e-mail is admin's e-mail.
Then I should see "moodle@moodlemoodle.com" in the "users" "table"
And I should see "Teacher" in the "users" "table"
And I should see "Student1" in the "users" "table"
And I should see "Student2" in the "users" "table"
And I should see "Student3" in the "users" "table"
And I follow "Show more..."
And I set the field "id_idnumber_op" to "is empty"
When I press "Add filter"
# We should see admin on the user list, the following e-mail is admin's e-mail.
Then I should see "moodle@moodlemoodle.com" in the "users" "table"
And I should not see "Teacher" in the "users" "table"
And I should not see "Student1" in the "users" "table"
And I should not see "Student2" in the "users" "table"
And I should not see "Student3" in the "users" "table"
@javascript
Scenario Outline: Filtering id numbers - with all other cases
# We should see see admin on the user list, the following e-mail is admin's e-mail.
Then I should see "moodle@moodlemoodle.com" in the "users" "table"
And I should see "Teacher" in the "users" "table"
And I should see "Student1" in the "users" "table"
And I should see "Student2" in the "users" "table"
And I should see "Student3" in the "users" "table"
And I follow "Show more..."
And I set the field "id_idnumber_op" to "<Category>"
And I set the field "idnumber" to "<Argument>"
When I press "Add filter"
Then I should <Admin's Visibility> "moodle@moodlemoodle.com" in the "users" "table"
And I should <Teacher's Vis> "Teacher" in the "users" "table"
And I should <S1's Vis> "Student1" in the "users" "table"
And I should <S2's Vis> "Student2" in the "users" "table"
And I should <S3's Vis> "Student3" in the "users" "table"
Examples:
| Category | Argument | Admin's Visibility | Teacher's Vis | S1's Vis | S2's Vis | S3's Vis |
| contains | 0 | not see | see | see | see | see |
| doesn't contain | 2 | see | not see | see | not see | see |
| is equal to | 2000000 | not see | not see | not see | see | not see |
| starts with | 0 | not see | see | see | not see | not see |
| ends with | 0 | not see | not see | not see | see | see |