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

Blocks WebServices may break when returning contributed plugins instance configuration (or even the RSS client one)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.8
    • 3.8
    • Other
    • MOODLE_38_STABLE
    • MOODLE_38_STABLE
    • MDL-67167-master
    • Hide
      Test
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Create a Token in the mobile app service for any user in the site (not an admin account)
      4. As admin, go to Site Administration > Plugins > Blocks > Manage Blocks
      5. Click on Site administration > Plugins > Blocks > Manage blocks
      6. Ensure that the "Remote RSS feeds" and "HTML" blocks are enabled
      7. Open the settings of Remote RSS feeds and go to Add/Edit feeds at the bottom
      8. Click "Add a new feed" and add the following RSS feed: URL: https://blog.ionicframework.com/feed/ (Please, ensure that the "Shared feed" option is set to Yes)
      9. Now, log in as the user you created the token for in step 3 access the site
      10. Go to dashboard and configure it via the "Customise this page" option so all the blocks listed in step 6 are displayed
      11. Please note that you will have to configure the blocks once added.
        • For the HTML block you will have to create some random content.
        • For the RSS block you will have to choose the "The Ionic blog" feed
      12. Open the console and execute this new curl request, replacing wstoken with the token you just created and the site url with yours.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_block_get_dashboard_blocks&wstoken=WSTOKEN' | python -m "json.tool"

      1. Please confirm that:
        • In the curl response you see the list of blocks in the user Dashboard
        • For the "html" block you'll see a list of settings including title and text (set to the block title and content) plus the "format" and "allowcssclasses" settings.
        • For the RSS block you'll see the rssid field set to "[\"1\"]"
      Show
      Test As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Click on Site administration ► Plugins ► Web services ► Manage tokens Create a Token in the mobile app service for any user in the site (not an admin account) As admin, go to Site Administration > Plugins > Blocks > Manage Blocks Click on Site administration > Plugins > Blocks > Manage blocks Ensure that the "Remote RSS feeds" and "HTML" blocks are enabled Open the settings of Remote RSS feeds and go to Add/Edit feeds at the bottom Click "Add a new feed" and add the following RSS feed: URL: https://blog.ionicframework.com/feed/ (Please, ensure that the "Shared feed" option is set to Yes) Now, log in as the user you created the token for in step 3 access the site Go to dashboard and configure it via the "Customise this page" option so all the blocks listed in step 6 are displayed Please note that you will have to configure the blocks once added. For the HTML block you will have to create some random content. For the RSS block you will have to choose the "The Ionic blog" feed Open the console and execute this new curl request, replacing wstoken with the token you just created and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_block_get_dashboard_blocks&wstoken=WSTOKEN' | python -m "json.tool" Please confirm that: In the curl response you see the list of blocks in the user Dashboard For the "html" block you'll see a list of settings including title and text (set to the block title and content) plus the "format" and "allowcssclasses" settings. For the RSS block you'll see the rssid field set to " [\"1\"] "

      There was a recent change for returning Block plugin and instance configurations.

      But it may break if a contributed plugin is storing non-scalar values as part of a block instance configuration. This is possible because the instance configuration is serialized and then base64 encoded before storing it in the data base.

      In order to prevent this, we must return always the JSON encoded representation of the scalar (or not scalar) values.

      STEPS TO REPRODUCE:
      1 Configure the RSS block pointing to a valid RSS source
      2 Create an instance of the RSS block in one course configured to use one of the valid sources
      3 Try to retrieve the blocks via the core_block_get_course_blocks WS, you will see a failure

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.