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

Add a method to unset user preferences

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a Token in the mobile app service for any user in the site (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Now, Log-out and as the user you created the token for, log in into the Moodle site
      4. "Hide from view" any of the courses displayed in the Dashboard (Course overview), please, annotate the id of the course you just hide.
      5. Refresh the page and check that the hidden course is displayed only when selecting the "Hidden" option in the "Course overview" filter.
      6. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours, replace the "X" in "block_myoverview_hidden_course_X" with the id of the course you annotated.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_user_update_user_preferences&wstoken=3af67232a7596ceb658df4db329e5ad6&preferences[0][type]=block_myoverview_hidden_course_X' | python -m "json.tool"

      7. Go back to the browser, access the site as the user you created the token for, and check that the course you hide is not hidden any more and you can see it when you select the "All" option in the "Course overview" filter
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for any user in the site (not an admin account) Click on Site administration ► Plugins ► Web services ► Manage tokens Now, Log-out and as the user you created the token for, log in into the Moodle site "Hide from view" any of the courses displayed in the Dashboard (Course overview), please, annotate the id of the course you just hide. Refresh the page and check that the hidden course is displayed only when selecting the "Hidden" option in the "Course overview" filter. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours, replace the "X" in "block_myoverview_hidden_course_X" with the id of the course you annotated. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_user_update_user_preferences&wstoken=3af67232a7596ceb658df4db329e5ad6&preferences [0] [type] =block_myoverview_hidden_course_X' | python -m "json.tool" Go back to the browser, access the site as the user you created the token for, and check that the course you hide is not hidden any more and you can see it when you select the "All" option in the "Course overview" filter
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-63929-master

      Description

      To hide and unhide a course the user preferrence block_myoverview_hidden_course_COURSEID is set or unset. There's no way to unset the param using WS.

      There are two ways to solve that:

      1. Add a new WS to unset a user preference.
      2. Admit some value into the update user preference WS to unset it (i.e. false).

      In addittion course overview block should consider values 0 or false as not hidden course here.

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              pferre22 Pau Ferrer
              Peer reviewer:
              Pau Ferrer
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Jennifer Bauzon
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Dec/18

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 30 minutes
                  1h 30m