AutorÃa | Ultima modificación | Ver Log |
@core @_file_uploadFeature: Profile picture accessIn order to enable precise security control and meet legal requirementsAs site administratorsWe should be able to prevent certain users from viewing profile picturesBackground:Given the following "users" exist:| username | firstname | lastname || student1 | Alice | in Wonderland || student2 | Bob | a Job Week |And the following "courses" exist:| shortname || C1 |And the following "course enrolments" exist:| user | course | role || student1 | C1 | student || student2 | C1 | student |And the following "activity" exists:| course | C1 || activity | forum || name | TestForum || idnumber | forum1 |And the following "mod_forum > discussions" exist:| user | forum | name | message | timemodified || student1 | forum1 | Post1 | This is the first post | ##now -1 second## |And the following "roles" exist:| shortname || dangerous |And the following "role capability" exists:| role | dangerous || moodle/user:viewprofilepictures | prohibit |And I am on the "Profile editing" page logged in as "student1"And I upload "/course/tests/fixtures/image.jpg" file to "New picture" filemanagerAnd I set the field "Picture description" to "MyPic"And I press "Update profile"@javascriptScenario: Users can view pictures on forum page when permittedWhen I am on the "forum1" "forum activity" page logged in as "student2"# By default you can see user pics.And ".discussion-list img.userpicture[src*='user/icon']" "css_element" should be visible# Even if you don't have the capability, you can still see them...And the following "system role assigns" exist:| user | role | contextlevel || student2 | dangerous | System |And I reload the pageAnd ".discussion-list img.userpicture[src*='user/icon']" "css_element" should be visible# ...unless forcelogin is on, when the system kicks in and hides it.And the following config values are set as admin:| forcelogin | 1 |And I reload the pageThen ".discussion-list img.userpicture[src*='user/icon']" "css_element" should not exist@javascriptScenario: Users can view pictures on profile page when permittedWhen I am on the "forum1" "forum activity" page logged in as "student2"And I follow "Post1"And I follow "Alice in Wonderland"# By default you can see user pics.And ".page-header-image img.userpicture[src*='user/icon']" "css_element" should be visible# Even if you don't have the capability, you can still see them...And the following "system role assigns" exist:| user | role | contextlevel || student2 | dangerous | System |And I reload the pageAnd ".page-header-image img.userpicture[src*='user/icon']" "css_element" should be visible# ...unless forcelogin is on, when the system kicks in and hides it.And the following config values are set as admin:| forcelogin | 1 |And I reload the pageThen ".page-header-image img.userpicture[src*='user/icon']" "css_element" should not exist