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

Blocks Web Services (for course and dashboard) should return the block settings

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      Test
      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. As admin, go to Site Administration > Plugins > Blocks > Manage Blocks
      4. Ensure that the "Recently accessed courses", "Starred courses", "Online users", "Course over view" and "HTML" blocks are enabled
      5. Open the settings of both Recently accessed courses", "Starred courses" and set the "Display categories" setting ON
      6. Now, as the user you created the token for in step 2 access the site
      7. Go to dashboard and configure it via the "Customise this page" option so all the blocks listed in step 4 are displayed
      8. Please note that for some blocks like the "Starred courses" or "Recently accessed courses" one you need to do some actions like "star" a course or access a course. For the HTML block you will have to create some random html content.
      9. Open the console an 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 "recentlyaccessedcourses" block you'll see a list of configs including "displaycategories" set to 1
        • For the "starredcourses" block you'll see a list of configs including "displaycategories" set to 1
        • 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
      Show
      Test 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 As admin, go to Site Administration > Plugins > Blocks > Manage Blocks Ensure that the "Recently accessed courses", "Starred courses", "Online users", "Course over view" and "HTML" blocks are enabled Open the settings of both Recently accessed courses", "Starred courses" and set the "Display categories" setting ON Now, as the user you created the token for in step 2 access the site Go to dashboard and configure it via the "Customise this page" option so all the blocks listed in step 4 are displayed Please note that for some blocks like the "Starred courses" or "Recently accessed courses" one you need to do some actions like "star" a course or access a course. For the HTML block you will have to create some random html content. Open the console an 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 "recentlyaccessedcourses" block you'll see a list of configs including "displaycategories" set to 1 For the "starredcourses" block you'll see a list of configs including "displaycategories" set to 1 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
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-65400-master

      Description

      We should add a new method to the base block class: get_config_for_external so blocks can return the block configuration settings (after capabilities permission checks).

      The reason for adding a new method is because the block settings may contain sensitive data like access keys or passwords so we should follow the same approach that we implemented in other plugins like assignment, database, course formats, and user profile fields.

      We need this to support new functionality like: MDL-64855

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  18/Nov/19

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 4 hours
                  1d 4h