Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-59913

Global search: Allow search of non-enrolled courses

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      Requirements

      This test assumes you have a working Moodle global search setup with Apache Solr or another search engine configured and enabled.

      Testing
      1. Create 4 courses A, B, C, and D. In each course add a label with the text 'Trexelvort A', 'Trexelvort B', etc. matching the course name.
      2. Set up guest access to be allowed in course B, and allowed with a password in course C (not allowed in A or D).
      3. In the permissions for course D, add an override so that the authenticated user role has moodle/course:view permission.
      4. Find or create two test accounts, referred to as U1 and U2. U1 should be enrolled as a student in course A. U2 should not be enrolled in any of these courses.
      5. Update the global search index (by waiting for cron, running the scheduled task manually, doing it from the commandline; whichever way is easiest), to ensure it has indexed the four new courses.
      6. Log in as user 1 and search for 'Trexelvort'. The result should only include Trexelvort A (where the user is enrolled).
      7. Log in as user 2 and do the search. There should be no results.
      8. As admin, go to the 'Manage global search' settings page and turn on the 'Searchable courses' option (set it to 'Search all courses user can access').
      9. Log in as user 1 and search for 'Trexelvort'. The result should now include Trexelvort A, B, and D (where the user is enrolled plus the two places that are available straight off).
      10. Log in as user 2 and do the search. The result should include Trexelvort B and D.
      11. Still as user 2, visit course C and log in as guest, typing in the guest password.
      12. Repeat the search.  The result should now include Trexelvort B, C, and D.
      13. As admin, do the search. This should show all four results.
      Show
      Requirements This test assumes you have a working Moodle global search setup with Apache Solr or another search engine configured and enabled. Testing Create 4 courses A, B, C, and D. In each course add a label with the text 'Trexelvort A', 'Trexelvort B', etc. matching the course name. Set up guest access to be allowed in course B, and allowed with a password in course C (not allowed in A or D). In the permissions for course D, add an override so that the authenticated user role has moodle/course:view permission. Find or create two test accounts, referred to as U1 and U2. U1 should be enrolled as a student in course A. U2 should not be enrolled in any of these courses. Update the global search index (by waiting for cron, running the scheduled task manually, doing it from the commandline; whichever way is easiest), to ensure it has indexed the four new courses. Log in as user 1 and search for 'Trexelvort'. The result should only include Trexelvort A (where the user is enrolled). Log in as user 2 and do the search. There should be no results. As admin, go to the 'Manage global search' settings page and turn on the 'Searchable courses' option (set it to 'Search all courses user can access'). Log in as user 1 and search for 'Trexelvort'. The result should now include Trexelvort A, B, and D (where the user is enrolled plus the two places that are available straight off). Log in as user 2 and do the search. The result should include Trexelvort B and D. Still as user 2, visit course C and log in as guest, typing in the guest password. Repeat the search.  The result should now include Trexelvort B, C, and D. As admin, do the search. This should show all four results.
    • Affected Branches:
      MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull Master Branch:
      MDL-59913-master

      Description

      At present the global search only works on courses in which the user is enrolled.

      In Moodle, users can access other courses as well as enrolled ones:

      • Courses where the user has moodle/course:view capability
      • Courses that allow guest access (with no password)
      • Courses that allow guest access with a password (and the user has provided a password)

      (In all cases, the course must be visible, or the user must have the viewhiddencourses capability.)

      The search facility should also work on these courses.

      Because of current limitation MDL-54992 that may cause search to stop working if the user can access more contexts, it will probably be necessary to include an admin setting to enable/disable this feature - otherwise there is a risk that sites which use search heavily, and also have lots of courses in the above categories, might find that search stops working for their users. The admin setting could be removed if MDL-54992 is fixed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                quen Sam Marshall
                Reporter:
                quen Sam Marshall
                Peer reviewer:
                Tim Hunt
                Integrator:
                Andrew Nicols
                Tester:
                John Okely
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                2 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Nov/17