Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.9
-
None
-
MOODLE_19_STABLE
-
MOODLE_20_STABLE
Description
Support for timestart in the capabilities code was removed by MDL-8785 mostly for performance reasons, although there was also a complicated justification of the decision.
IMO this behaviour is bad - it's very confusing. You set a user's enrolment to the future but they are allowed to access the site now? why? (Removing on cron is ok for the end date...) Adding and removing things in enrolment plugins may be technically possible but could be pretty difficult.
In my opinion, if timestart is not implemented properly then it should be removed from the database.
However, with the new queries it should probably not be a performance issue as far as I can see (they don't look that scary). I have done a patch (against 1.9 actually though probably a suitable change for that) which adds this feature back, attached. The patch applies only to functions which are normally used to check permissions, not to all the 'informational' ones (so e.g. if you get a list of the students on a course, it will still include those who 'haven't started yet', etc - they just won't be able to get in yet).
I have not yet tested performance. Would it be worth doing so?