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

Remove timestart and timeend from consideration by load_user_capability()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.7, 1.7.1, 1.7.2, 1.8
    • Fix Version/s: 1.7.2, 1.8
    • Component/s: Enrolments, Roles / Access
    • Labels:
      None
    • Affected Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE

      Description

      Eloy has correctly identified timestart and timeend as a big database bottleneck in load_user_capability because they prevent caching and deal with inequalities, so let's get rid if them!

      These times specify the duration that the enrolment is active. Currently they are only used by self-enrolling courses where the course has a duration. In these instance timestart is set to now and timeend is set to some time in the future. Zero in timestart means inifinite past, and in timeend means inifinite future.

      We were checking these to cope with all cases where people might want to set enrolment durations starting and ending in the future, but this is actually not very useful. Let's let the enrolment plugins handle such things (adding role assignments on the fly where necessary).

      So instead, I propose:

      1) We remove the time checks completely from load_user_capability and assume all role assigments in the database are valid.

      2) We add a cron check to delete any role assignments where (timeend > 0 AND timeend < $now)

      3) We make sure this is documented well in the code and on the wiki.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dougiamas Martin Dougiamas
              Reporter:
              dougiamas Martin Dougiamas
              Tester:
              Nobody
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                30/Mar/07