Rev 1 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
@core_reportbuilder @javascriptFeature: Configure access to reports based on intended audienceAs an adminI want to restrict which users have access to a reportBackground:Given the following "custom profile fields" exist:| datatype | shortname | name || text | fruit | Fruit |And the following "users" exist:| username | firstname | middlename | lastname | email | profile_field_fruit || user1 | User | One | 1 | user1@example.com | Apple || user2 | User | Two | 2 | user2@example.com | Banana || user3 | User | Three | 3 | user3@example.com | Banana |And the following "core_reportbuilder > Reports" exist:| name | source | default || My report | core_user\reportbuilder\datasource\users | 1 |Scenario: Configure report audience with manually added users audience typeWhen I log in as "user1"And I follow "Reports" in the user menuAnd I should see "Nothing to display"And I log outAnd I am on the "My report" "reportbuilder > Editor" page logged in as "admin"And I click on the "Access" dynamic tabAnd I should see "Nothing to display"And I click on the "Audience" dynamic tabAnd I should see "There are no audiences for this report"And I click on "Add audience 'Manually added users'" "link"And I should see "Added audience 'Manually added users'"And I should see "Audience not saved" in the "Manually added users" "core_reportbuilder > Audience"And I set the following fields in the "Manually added users" "core_reportbuilder > Audience" to these values:| Add users manually | User 1,User 3 |And I press "Save changes"And I should see "Audience saved"And I should not see "Audience not saved" in the "Manually added users" "core_reportbuilder > Audience"And I should see "User 1, User 3" in the "Manually added users" "core_reportbuilder > Audience"And I should not see "There are no audiences for this report"And I click on the "Access" dynamic tabAnd I should see "User 1" in the "reportbuilder-table" "table"And I should not see "User 2" in the "reportbuilder-table" "table"And I should see "User 3" in the "reportbuilder-table" "table"And I log outAnd I log in as "user1"And I follow "Reports" in the user menuThen I should see "My report" in the "reportbuilder-table" "table"And I click on "My report" "link" in the "My report" "table_row"And I should see "User 1" in the "reportbuilder-table" "table"Scenario: Configure report audience with administrator audience typeGiven I am on the "My report" "reportbuilder > Editor" page logged in as "admin"And I click on the "Audience" dynamic tabWhen I click on "Add audience 'Site administrators'" "link"And I press "Save changes"Then I should see "Audience saved"And I click on the "Access" dynamic tabAnd I should see "Admin User" in the "reportbuilder-table" "table"And I should not see "User 1" in the "reportbuilder-table" "table"And I should not see "User 2" in the "reportbuilder-table" "table"And I should not see "User 3" in the "reportbuilder-table" "table"Scenario: Configure report audience with has system role audience typeGiven the following "role assigns" exist:| user | role | contextlevel | reference || user2 | manager | System | |And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"And I click on the "Audience" dynamic tabWhen I click on "Add audience 'Assigned system role'" "link"And I should see "Added audience 'Assigned system role'"And I set the following fields in the "Assigned system role" "core_reportbuilder > Audience" to these values:| Select a role | Manager |And I press "Save changes"Then I should see "Audience saved"And I should see "Manager" in the "Assigned system role" "core_reportbuilder > Audience"And I click on the "Access" dynamic tabAnd I should not see "User 1" in the "reportbuilder-table" "table"And I should see "User 2" in the "reportbuilder-table" "table"And I should not see "User 3" in the "reportbuilder-table" "table"And I log outAnd I am on the "My report" "reportbuilder > View" page logged in as "user2"And I should see "User 1" in the "reportbuilder-table" "table"Scenario: Configure report audience with Member of cohort audience typeGiven the following "cohorts" exist:| name | idnumber || Cohort1 | cohort1 |And the following "cohort members" exist:| cohort | user || cohort1 | user3 |And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"And I click on the "Audience" dynamic tabWhen I click on "Add audience 'Member of cohort'" "link"And I should see "Added audience 'Member of cohort'"And I set the following fields in the "Member of cohort" "core_reportbuilder > Audience" to these values:| Select members from cohort | Cohort1 |And I press "Save changes"Then I should see "Audience saved"And I should see "Cohort1" in the "Member of cohort" "core_reportbuilder > Audience"And I click on the "Access" dynamic tabAnd I should not see "User 1" in the "reportbuilder-table" "table"And I should not see "User 2" in the "reportbuilder-table" "table"And I should see "User 3" in the "reportbuilder-table" "table"And I log outAnd I am on the "My report" "reportbuilder > View" page logged in as "user3"And I should see "User 1" in the "reportbuilder-table" "table"Scenario: Configure report audience with Member of cohort audience type with no cohorts availableGiven I am on the "My report" "reportbuilder > Editor" page logged in as "admin"When I click on the "Audience" dynamic tabThen "Add audience 'All users'" "link" should exist# This audience type should be disabled because there are no cohorts available.And "Add audience 'Member of cohort'" "link" should not existAnd the "title" attribute of "//div[@data-region='sidebar-menu']/descendant::div[normalize-space(.)='Member of cohort']" "xpath_element" should contain "Not available"Scenario: Configure report audience as user who cannot use specific audienceGiven the following "users" exist:| username | firstname | lastname || manager1 | Manager | 1 |And the following "role assigns" exist:| user | role | contextlevel | reference || manager1 | manager | System | |And the following "permission overrides" exist:| capability | permission | role | contextlevel | reference || moodle/reportbuilder:editall | Allow | manager | System | || moodle/cohort:view | Prohibit | manager | System | |And I am on the "My report" "reportbuilder > Editor" page logged in as "manager1"When I click on the "Audience" dynamic tabThen I should not see "Member of cohort" in the "[data-region='sidebar-menu']" "css_element"Scenario: Search for and add audience to reportGiven I am on the "My report" "reportbuilder > Editor" page logged in as "admin"And I click on the "Audience" dynamic tabWhen I set the field "Search" in the "[data-region=sidebar-menu]" "css_element" to "All users"Then I should see "All users" in the "[data-region=sidebar-menu]" "css_element"And I should not see "Member of cohort" in the "[data-region=sidebar-menu]" "css_element"And I click on "Add audience 'All users'" "link"And I should see "Added audience 'All users'"And I press "Save changes"And I should see "Audience saved"Scenario: Rename report audienceGiven I am on the "My report" "reportbuilder > Editor" page logged in as "admin"And I click on the "Audience" dynamic tabAnd I click on "Add audience 'All users'" "link"And I press "Save changes"When I set the field "Rename audience 'All users'" to "All my lovely users"And I reload the pageThen I should see "All my lovely users" in the "[data-region='audience-card']" "css_element"Scenario: Rename report audience using filtersGiven the "multilang" filter is "on"And the "multilang" filter applies to "content and headings"And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"And I click on the "Audience" dynamic tabAnd I click on "Add audience 'All users'" "link"And I press "Save changes"When I set the field "Rename audience 'All users'" to "<span class=\"multilang\" lang=\"en\">English</span><span class=\"multilang\" lang=\"es\">Spanish</span>"And I reload the pageThen I should see "English" in the "[data-region='audience-card']" "css_element"And I should not see "Spanish" in the "[data-region='audience-card']" "css_element"Scenario: Delete report audienceGiven I am on the "My report" "reportbuilder > Editor" page logged in as "admin"And I click on the "Audience" dynamic tabAnd I click on "Add audience 'All users'" "link"And I press "Save changes"When I click on "Delete audience 'All users'" "button"And I should see "Are you sure you want to delete the audience 'All users'?" in the "Delete audience 'All users'" "dialogue"And I click on "Delete" "button" in the "Delete audience 'All users'" "dialogue"Then I should see "Deleted audience 'All users'"And "All users" "core_reportbuilder > Audience" should not existAnd I should see "There are no audiences for this report"Scenario: Delete report audience used in scheduleGiven the following "core_reportbuilder > Audiences" exist:| report | configdata || My report | |And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"And I click on the "Schedules" dynamic tabAnd I press "New schedule"And I set the following fields in the "New schedule" "dialogue" to these values:| Name | My schedule || Starting from | ##tomorrow 11:00## || All users | 1 || Subject | Cause you know just what to say || Body | And you know just what to do |And I click on "Save" "button" in the "New schedule" "dialogue"When I click on the "Audience" dynamic tabThen I should see "This audience is used in a schedule for this report" in the "All users" "core_reportbuilder > Audience"And I click on "Delete audience 'All users'" "button"And I should see "This audience is used in a schedule for this report" in the "Delete audience 'All users'" "dialogue"And I click on "Delete" "button" in the "Delete audience 'All users'" "dialogue"And I should see "Deleted audience 'All users'"And "All users" "core_reportbuilder > Audience" should not existAnd I should see "There are no audiences for this report"Scenario: Edit report audience with manually added users audience typeGiven I am on the "My report" "reportbuilder > Editor" page logged in as "admin"And I click on the "Access" dynamic tabAnd I should see "Nothing to display"And I click on the "Audience" dynamic tabAnd I click on "Add audience 'Manually added users'" "link"And I set the following fields in the "Manually added users" "core_reportbuilder > Audience" to these values:| Add users manually | User 1,User 3 |And I press "Save changes"When I press "Edit audience 'Manually added users'"And "User 1" "autocomplete_selection" in the "Manually added users" "core_reportbuilder > Audience" should be visibleAnd "User 3" "autocomplete_selection" in the "Manually added users" "core_reportbuilder > Audience" should be visibleAnd I set the following fields in the "Manually added users" "core_reportbuilder > Audience" to these values:| Add users manually | User 2 |And I press "Save changes"Then I should see "Audience saved"And I should see "User 2" in the "Manually added users" "core_reportbuilder > Audience"And I click on the "Access" dynamic tabAnd I should not see "User 1" in the "reportbuilder-table" "table"And I should see "User 2" in the "reportbuilder-table" "table"And I should not see "User 3" in the "reportbuilder-table" "table"Scenario: View configured user additional names on the access tabGiven the following config values are set as admin:| alternativefullnameformat | firstname middlename lastname |And the following "core_reportbuilder > Audiences" exist:| report | configdata || My report | |And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"When I click on the "Access" dynamic tabThen I should see "User One 1" in the "reportbuilder-table" "table"And I should see "User Two 2" in the "reportbuilder-table" "table"And I should see "User Three 3" in the "reportbuilder-table" "table"# Now sort each of them.And I click on "First name" "link" in the "reportbuilder-table" "table"And "Admin User" "table_row" should appear before "User One 1" "table_row"And I click on "First name" "link" in the "reportbuilder-table" "table"And "User One 1" "table_row" should appear before "Admin User" "table_row"And I click on "Middle name" "link" in the "reportbuilder-table" "table"And "User Two 2" "table_row" should appear before "User One 1" "table_row"And I click on "Middle name" "link" in the "reportbuilder-table" "table"And "User One 1" "table_row" should appear before "User Two 2" "table_row"And I click on "Last name" "link" in the "reportbuilder-table" "table"And "User One 1" "table_row" should appear before "User Two 2" "table_row"And I click on "Last name" "link" in the "reportbuilder-table" "table"And "User Two 2" "table_row" should appear before "User One 1" "table_row"Scenario: View configured user identity fields on the access tabGiven the following config values are set as admin:| showuseridentity | email,profile_field_fruit |And the following "core_reportbuilder > Audiences" exist:| report | configdata || My report | |And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"When I click on the "Access" dynamic tabThen the following should exist in the "reportbuilder-table" table:| -1- | Email address | Fruit || User 1 | user1@example.com | Apple || User 2 | user2@example.com | Banana || User 3 | user3@example.com | Banana |# Now let's filter them.And I click on "Filters" "button"And I set the following fields in the "Fruit" "core_reportbuilder > Filter" to these values:| Fruit operator | Is equal to || Fruit value | Banana |And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"And I should not see "User 1" in the "reportbuilder-table" "table"And I should see "User 2" in the "reportbuilder-table" "table"And I should see "User 3" in the "reportbuilder-table" "table"And I set the following fields in the "Email address" "core_reportbuilder > Filter" to these values:| Email address operator | Contains || Email address value | user2 |And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"And I should not see "User 1" in the "reportbuilder-table" "table"And I should see "User 2" in the "reportbuilder-table" "table"And I should not see "User 3" in the "reportbuilder-table" "table"Scenario: View report as a user with edit capabilityGiven the following "roles" exist:| shortname | name | archetype || viewreportsrole | Test role | |And the following "role assigns" exist:| user | role | contextlevel | reference || user1 | viewreportsrole | System | |And the following "permission overrides" exist:| capability | permission | role | contextlevel | reference || moodle/reportbuilder:editall | Prohibit | viewreportsrole | System | || moodle/reportbuilder:edit | Allow | viewreportsrole | System | || moodle/reportbuilder:view | Prohibit | viewreportsrole | System | |When I log in as "user1"And I follow "Reports" in the user menuAnd I should see "Nothing to display"And I click on "New report" "button"And I set the following fields in the "New report" "dialogue" to these values:| Name | My user1 report || Report source | Users || Include default setup | 1 |And I click on "Save" "button" in the "New report" "dialogue"And I click on "Close 'My user1 report' editor" "button"And I should see "My user1 report" in the "reportbuilder-table" "table"And I press "View report" action in the "My user1 report" report rowAnd I should see "User 1" in the "reportbuilder-table" "table"Scenario: View report as a user with editall capabilityGiven the following "roles" exist:| shortname | name | archetype || viewreportsrole | Test role | |And the following "role assigns" exist:| user | role | contextlevel | reference || user1 | viewreportsrole | System | |And the following "permission overrides" exist:| capability | permission | role | contextlevel | reference || moodle/reportbuilder:editall | Allow | viewreportsrole | System | || moodle/reportbuilder:edit | Prohibit | viewreportsrole | System | || moodle/reportbuilder:view | Prohibit | viewreportsrole | System | |When I log in as "user1"And I follow "Reports" in the user menuThen I should see "My report" in the "reportbuilder-table" "table"And I press "View report" action in the "My report" report rowAnd I should see "User 1" in the "reportbuilder-table" "table"