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

Invalid parameter error when a calendar block has limited permission

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Login as admin
      2. Navigate to Site home
      3. Select Turn editing on from the Actions menu
      4. Press Add a block
      5. Press on the Calendar block
      6. In the new Calendar block, select Permissions from the Actions menu
      7. For the capability "View block", press Delete authenticated user role
      8. Confirm that you really want to remove "Authenticated user" from the list of allowed roles for capability "View block" in context "Block: Calendar"
      9. Navigate back to Site home and confirm the Calendar block is still present and you can scroll through the months via AJAX
      10. Logout
      11. Login as a normal user
      12. Navigate to Site home
      13. Confirm you don't get an "Invalid parameter value detected" exception on the page
      14. Confirm the Calendar block isn't present (because you don't have the capability to view it)
      15. Confirm any other blocks on the page are still present
      Show
      Login as admin Navigate to Site home Select Turn editing on from the Actions menu Press Add a block Press on the Calendar block In the new Calendar block, select Permissions from the Actions menu For the capability "View block", press Delete authenticated user role Confirm that you really want to remove "Authenticated user" from the list of allowed roles for capability "View block" in context "Block: Calendar" Navigate back to Site home and confirm the Calendar block is still present and you can scroll through the months via AJAX Logout Login as a normal user Navigate to Site home Confirm you don't get an "Invalid parameter value detected" exception on the page Confirm the Calendar block isn't present (because you don't have the capability to view it) Confirm any other blocks on the page are still present
    • Affected Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE
    • Pull 3.8 Branch:
    • Pull Master Branch:

      Description

      Hi,

      I put a calendar block only on the default dashboard or on the home page for all site.
      I limit the view block permission for only one system role, auther than "Authentticated user". For example, only "manager" can see the block.

      When one page with de block is dipalyed and if the user has not the role with the permission to view the calendar block (not "manager" in my above example), the folowing error occurs :

        Invalid parameter value detected
      File: /lib/externallib.php
      Line: 332
      Stack trace:
      Missing required key in single structure: year
      Error code: invalidparameter

      • line 332 of /lib/externallib.php: invalid_parameter_exception thrown
      • line 223 of /lib/externallib.php: call to external_api::validate_parameters()
      • line 79 of /lib/ajax/service.php: call to external_api::call_external_function()
         
        I had see the bug for the first time on Moodle 3.8+(Build: 20191205) and I do a test on the lasted 3.8.1+(Build: 20200228) with the same issue.
        It's a similar issue than [MDL-67140|http://example.com,] normaly resolved.
         
        The steps to reproduce the issue are :

      1) On the home page, put a calendar block (for all pages in my use case).
      2) Limit the block view permission for only one system role, but not "Authentticated user" ("manager" , for example).
      3) Connect you whith an user who does not have the role with the permission (not "manager" in my above example).
      4) Go to a page where the calendar block is potentialy dispalyed.

      Best regards,
      Jacques
       

        Attachments

          Activity

            People

            Assignee:
            pholden Paul Holden
            Reporter:
            jibecc Jacques Barzic
            Peer reviewer:
            Peter Dias
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            Anna Carissa Sadia
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              13/Jul/20

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 50 minutes
                2h 50m