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

Improve enrol plugins to better handle its unique/multiple property

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.0, 2.1.1, 2.2
    • None
    • Enrolments
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE

    Description

      When working on MDL-26841, I detected one inconsistency/missing feature in the enrollment api: It seems that the detection/permission to create multiple instances is somehow incomplete. So for example:

      • In one course already having one "guest" plugin, the get_newinstance_link() method properly detects it and avoids to return one link to create a new instance.
      • But in the same course, the add_instance() method does not detect it and creates one new instance without problems.

      So, I think we should implement/extend the API to:

      1) Define, for each enrol plugin, if multiple instances are allowed for a given context. And provide public getter for that.
      2) Define another method, ideally public too, to perform all the checks necessary to detect if one new instance can be added (returns true/false).
      3) Optional: make add_instance() to use 1 & 2 above and return null if the instance was not created (there are code relying on this right now).

      That is, for your consideration. Surely we should offer BC defaults to current behavior and perhaps it's one new feature/bugfix so I'd consider backporting it to 21_STABLE.

      Ciao

      Attachments

        Issue Links

          Activity

            People

              skodak Petr Skoda
              stronk7 Eloy Lafuente (stronk7)
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Sara Arjona (@sarjona)
              Votes:
              4 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: