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

Allow users in course to access cohorts defined in course category or system

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      pretty good covered by behat and unittests. But you can manually make sure that teacher can see and access cohorts defined in the contexts above unless they are invisible.
      Currently teacher can "access cohorts" only in enrol_cohort plugin and when Auto-creating groups from cohort members

      Show
      pretty good covered by behat and unittests. But you can manually make sure that teacher can see and access cohorts defined in the contexts above unless they are invisible. Currently teacher can "access cohorts" only in enrol_cohort plugin and when Auto-creating groups from cohort members
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE
    • Pull Master Branch:
      wip-MDL-36014-master

      Description

      Currently teachers in the course are unable to use enrol_cohort because the capability to view cohorts (moodle/cohort:view) is checked on the level where cohort was created - system or course category. Since editingteacher role is given inside the course, the teacher by default can not use enrol_cohort. At the same time teacher is able to auto-create groups from cohort memebers.
      It was decided to allow users in the courses to view cohorts defined in the above contexts unless admin/manager has unchecked 'visibile' checkbox for the cohort.

      In this issue:

      • we add field cohort.visible and support it when editing, uploading cohorts and in web services.
      • add API methods cohort_can_view_cohort() and cohort_get_available_cohorts() that replace similar methods and plain DB queries in enrolment plugins and auto-create group form
      • remove checking of capability moodle/cohort:view from enrol_cohort plugin (capability 'moodle/course:enrolconfig' is still required)

      ------

      Original description:

      The point is to allow teachers to use cohorts in enrolments plugins without having extra role in contexts above course.

      • moodle/cohort:view - is used in has_capability() called with the category context where the cohort is defined (in future it may be cohort context itself)
      • new moodle/cohort:viewabove would be used in course contexts, giving user permission to use all cohorts defined in system and parent course categories.

      The list of available cohorts in enrol_manual and enrol_self would be constructed as a sum of cohorts allowed by both capabilities.

      Combination of these two capabilities should give use enough enough flexibility in different scenarios - see https://moodle.org/mod/forum/discuss.php?d=213598

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                9 Vote for this issue
                Watchers:
                19 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Nov/14