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

Create cohort context level

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 4.1
    • None
    • Cohorts
    • MOODLE_401_STABLE
    • Hide

      The upgrade process is not fully covered by tests, it needs to be tested manually:

      1. install Moodle without patch
      2. add several cohorts with images indescriptions
      3. use inline cohort ID number editing to set duplicate idnumbers
      4. upgrade to patched version
      5. verify the images are showing fine
      6. verify only the cohort with lowest record id has the original idnumber if there were duplicates
      Show
      The upgrade process is not fully covered by tests, it needs to be tested manually: install Moodle without patch add several cohorts with images indescriptions use inline cohort ID number editing to set duplicate idnumbers upgrade to patched version verify the images are showing fine verify only the cohort with lowest record id has the original idnumber if there were duplicates

    Description

      It would be beneficial to create dedicated context levels so that management and assignment permissions can be deleted for particular cohorts instead of all cohorts in a category and subcategories.

      Implementation

      The view permissions should be kept at the system/category/course cohort because it is already complicated enough and it would be better to improve it later in a separate issue.

      While implemented this patch and adding new test coverage I have found and fixed a few related bugs:

      • external API for adding and removing cohort members was incorrectly allowing operation with moodle/cohort:manage instead of only moodle/cohort:assign
      • the inline editing of idnumbers did not check for duplicates, empty cohort idnumber was using both null and empty string - solution was to add unique database index and appropriate duplicate checks into low level APIs

      Changes for end users

      There is a new 3rd level navigation when editing cohort details with links to role assignments and permissions in new cohort context - only moodle/cohort:manage and moodle/assign permissions are compatible with the new cohort context.

      Changes for developers

      To get context for management of cohort use this code:

      $cohortcontext = \context_cohort::instance($cohort->id); 

      Attachments

        Issue Links

          Activity

            People

              skodak Petr Skoda
              skodak Petr Skoda
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: