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

mod/assign: Check 'grantextension' capability before showing "Grant extension" option

XMLWordPrintable

    • MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_24_STABLE, MOODLE_25_STABLE
    • MDL-39743-master
    • Hide

      Steps to replicate:

      1 Create a tutor role as a clone of editingteacher but with only these

      mod/assign caps:
      mod/assign:exportownsubmission
      mod/assign:grade
      mod/assign:view

      2 Log in as tutor
      3 View assignment submissions
      4 Select one or more submissions
      5 In the “with selected” dropdown list (bottom of submissions table), “grant extension” appears
      6 Choose “grant extension”, then go, then confirm
      7 Enable and choose an extension date
      8 Save changes
      9 Error message is displayed - “Sorry, you do not have permissions to do that (grant extension)”

      Steps to test fix:

      1 Log in as tutor
      2 View assignment submissions
      3 Select one or more submissions
      4 In the “with selected” dropdown list (bottom of submissions table), ensure “grant extension” does not appear

      Show
      Steps to replicate: 1 Create a tutor role as a clone of editingteacher but with only these mod/assign caps: mod/assign:exportownsubmission mod/assign:grade mod/assign:view 2 Log in as tutor 3 View assignment submissions 4 Select one or more submissions 5 In the “with selected” dropdown list (bottom of submissions table), “grant extension” appears 6 Choose “grant extension”, then go, then confirm 7 Enable and choose an extension date 8 Save changes 9 Error message is displayed - “Sorry, you do not have permissions to do that (grant extension)” Steps to test fix: 1 Log in as tutor 2 View assignment submissions 3 Select one or more submissions 4 In the “with selected” dropdown list (bottom of submissions table), ensure “grant extension” does not appear

      When viewing assignment submissions, users are given a dropdown to select numerous available actions to perform on the selected submissions. The "grant extension" option shows up regardless of the mod/assign:grantextension capability. If a user without the capability chooses the "grant extension" option, they will will be presented with the form to grant an extension, but when they submit it they will see a capability error and the extension will not be saved.

      I've attached a patch file for 2.4, but it is not necessarily the "proper" way to fix it. To make this fit more into the rest of the code design, perhaps the form definition shouldn't have any capability checks, but instead call to the assignment to add the extension option if its available. eg. $assign->add_extension_elements() or something.

      Patch attached as a starting point.

            damyon Damyon Wiese
            ashleyholman Ashley Holman
            Damyon Wiese Damyon Wiese
            Dan Poltawski Dan Poltawski
            Jason Fowler Jason Fowler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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