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

Make "course request" capability category context instead of system context

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      For an upgraded site:

      1. Go to Site administration>Courses>Course requests and make sure that:
        • enablecourserequest is off
        • lockrequestcategory is on
      2. Enable course requests
      3. Go to "Site administration>Users>Define roles" and make sure that "Authenticated user" role has a 'moodle/course:request' cap
      4. Login as a regular user, go to the /course/ page and make sure you have a "Request a course" button there

      Freshly installed sites:

      1. Go to "Site administration>Courses>Course requests" and make sure that:
        • enablecourserequest is on
        • lockrequestcategory is off
      2. Go to "Site administration>Users>Define roles" and make sure that "Authenticated user" role does not have a 'moodle/course:request' cap
      3. Create a custom role (no archetype, assignable in course category context) with only one allowed capability 'moodle/course:request'
      4. Enable course requests (Site administration>Courses>Course requests)
      5. Assign two different users the new role in the different categories contexts, one of them for the "default course request category" (Miscellaneous)
      6. Enable setting lockrequestcategory
      7. For user who has capability in the Misc category - make sure he can requests courses in this category but no other - search for "Request a course" button in the category listing
      8. For another user make sure the button "Request a course" does not appear in any category
      9. Disable setting lockrequestcategory
      10. Make sure the first user still can request only in the Misc category
      11. Make sure the second user can request only in his other category
      12. Assign Manager role to the third user in a context of only of of these two categories
      13. Make sure he can approve courses only in the category where he is assigned a role (go to the category listing and there should be a button in the bottom of the page)
      Show
      For an upgraded site: Go to Site administration>Courses>Course requests and make sure that: enablecourserequest is off lockrequestcategory is on Enable course requests Go to "Site administration>Users>Define roles" and make sure that "Authenticated user" role has a 'moodle/course:request' cap Login as a regular user, go to the /course/ page and make sure you have a "Request a course" button there Freshly installed sites: Go to "Site administration>Courses>Course requests" and make sure that: enablecourserequest is on lockrequestcategory is off Go to "Site administration>Users>Define roles" and make sure that "Authenticated user" role does not have a 'moodle/course:request' cap Create a custom role (no archetype, assignable in course category context) with only one allowed capability 'moodle/course:request' Enable course requests (Site administration>Courses>Course requests) Assign two different users the new role in the different categories contexts, one of them for the "default course request category" (Miscellaneous) Enable setting lockrequestcategory For user who has capability in the Misc category - make sure he can requests courses in this category but no other - search for "Request a course" button in the category listing For another user make sure the button "Request a course" does not appear in any category Disable setting lockrequestcategory Make sure the first user still can request only in the Misc category Make sure the second user can request only in his other category Assign Manager role to the third user in a context of only of of these two categories Make sure he can approve courses only in the category where he is assigned a role (go to the category listing and there should be a button in the bottom of the page)
    • Affected Branches:
      MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE
    • Pull Master Branch:
      MDL-66740-master

      Description

      Capability 'moodle/course:request' can only be assigned in system context, this is very inconvenient if we want to give user option to request only in limited categories. Even if $CFG->requestcategoryselection is enabled, the capability is checked in the system context.

      The button "Request course" is displayed on every category page and when clicking on it, the category selector is not prefilled with the category where user was.

        Attachments

        1. after.png
          after.png
          122 kB
        2. before.png
          before.png
          101 kB
        3. Screenshot_1.png
          Screenshot_1.png
          16 kB
        4. Screenshot_2.png
          Screenshot_2.png
          219 kB

          Issue Links

            Activity

              People

              Assignee:
              marina Marina Glancy
              Reporter:
              marina Marina Glancy
              Peer reviewer:
              Carlos Escobedo
              Integrator:
              Adrian Greeve
              Tester:
              Janelle Barcega
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              8 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 - 3 days, 1 hour, 30 minutes
                  3d 1h 30m