1 |
efrain |
1 |
@core @core_admin
|
|
|
2 |
Feature: Staff can check user permissions
|
|
|
3 |
In order to find out whether a user can or can't do something
|
|
|
4 |
As an admin
|
|
|
5 |
I can check their permissions in a particular context
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "custom profile fields" exist:
|
|
|
9 |
| datatype | shortname | name |
|
|
|
10 |
| text | frog | Favourite frog |
|
|
|
11 |
And the following config values are set as admin:
|
|
|
12 |
| showuseridentity | email,profile_field_frog |
|
|
|
13 |
And the following "users" exist:
|
|
|
14 |
| username | firstname | lastname | email | profile_field_frog |
|
|
|
15 |
| user1 | User | One | one@example.com | Kermit |
|
|
|
16 |
| user2 | User | Two | two@example.com | Tree |
|
|
|
17 |
| user3 | User | Three | thr@example.com | Kermit |
|
|
|
18 |
And the following "courses" exist:
|
|
|
19 |
| shortname | fullname |
|
|
|
20 |
| C1 | Course 1 |
|
|
|
21 |
| C2 | Course 2 |
|
|
|
22 |
And the following "course enrolments" exist:
|
|
|
23 |
| user | course | role |
|
|
|
24 |
| user1 | C1 | editingteacher |
|
|
|
25 |
| user2 | C1 | editingteacher |
|
|
|
26 |
| user3 | C2 | editingteacher |
|
|
|
27 |
|
|
|
28 |
@javascript
|
|
|
29 |
Scenario: Search for a user (enrolled on the course) by custom field and select them to see permissions
|
|
|
30 |
When I am on the "C1" "permissions" page logged in as "admin"
|
|
|
31 |
And I set the field "Participants tertiary navigation" to "Check permissions"
|
|
|
32 |
And I set the field "Search" to "Kermit"
|
|
|
33 |
# The Behat 'I should see' step doesn't work for optgroup labels.
|
|
|
34 |
Then "optgroup[label='Matching enrolled users (1)']" "css_element" should exist
|
|
|
35 |
And I should see "User One (one@example.com, Kermit)"
|
|
|
36 |
And I should not see "User Two"
|
|
|
37 |
And I set the field "reportuser" to "User One (one@example.com, Kermit)"
|
|
|
38 |
And I press "Show this user's permissions"
|
|
|
39 |
And I should see "Permissions for user User One"
|
|
|
40 |
And I should see "Yes" in the "Add a new forum" "table_row"
|
|
|
41 |
|
|
|
42 |
@javascript
|
|
|
43 |
Scenario: Search for a user (not enrolled on the course) by custom field and select them to see permissions
|
|
|
44 |
When I am on the "C1" "permissions" page logged in as "admin"
|
|
|
45 |
And I set the field "Participants tertiary navigation" to "Check permissions"
|
|
|
46 |
And I set the field "Search" to "Kermit"
|
|
|
47 |
# The Behat 'I should see' step doesn't work for optgroup labels.
|
|
|
48 |
Then "optgroup[label*='Potential users matching'][label*=' (1)']" "css_element" should exist
|
|
|
49 |
And I should see "User Three (thr@example.com, Kermit)"
|
|
|
50 |
And I should not see "User Two"
|
|
|
51 |
And I set the field "reportuser" to "User Three (thr@example.com, Kermit)"
|
|
|
52 |
And I press "Show this user's permissions"
|
|
|
53 |
Then I should see "Permissions for user User Three"
|
|
|
54 |
And I should see "No" in the "Add a new forum" "table_row"
|