|
[
Permalink
| « Hide
]
Sam Marshall added a comment - 30/Jan/08 03:32 AM
'Probably not a suitable change for 1.9', that was supposed to say. Although I note that interface supporting timestart has been added, so it's a bit embarrassing that it doesn't work. (Could be resolved by removing the UI again...)
The main problem was performance of the inequalities on some really heavy-used JOIN queries (forum cron, for example). I don't think these should be brought back.
The suggestion in UPDATE role_assignments SET current = (timestart < $now AND (timeend >= $now OR timeend=0 ) ) Would have to be 2.0 though, as it would mean a new field. Where is the interface to support timestart that you refer to? UI is in admin/roles/assign.php, the 'Starting from' dropdown affects timestart; sets either now, or course start date. IMO this option should probably be hidden for 1.9 release since it isn't going to be implemented.
(There is also a dropdown 'Enrolment duration' which uses timeend so presumably works.) If there are performance problems with inequalities in general in some databases (rather than just when they're part of very complex queries which is what I had assumed) then I agree that your solution to update on cron is better. There are also a few other issues in this area to do with how this is displayed. For example it might be nice if users who are 'not current' were shown greyed-out in the interface, etc. So maybe it is a bigger task... [I guess we can live without timestart working as long as we're careful not to set the 'visible to students' flag on courses until they go live, so I think we'll do that locally for now.] Gah, update - apparently that's not an acceptable solution for us, we need this to work.
I will do a patch shortly for 2.0 to add the database field 'current' , the cron query to check timestart and update current, and the check of 'current' in the same queries that were affected in my original patch. Don't think so, sorry! However here is the latest patch for 1.9 (I think - I also have an 'OU update' one, but I think that is based on this as the times are very similar.
Looks good! Bouncing to Tim!
(Don't forget to remove the timestart/timeend rounding code mentioned in hmm, I agree that time limited role assignments are good in some specific cases, but I do not agree these should be used to limit course enrolments - this seems like just another hack to work around problems caused by course:view, legacy guest capability, etc. Major problem is that if you do not have any role with course:view in course you are unenrolled from course and some of your data is lost!
I suppose people want to limit access to course depending on some dates/conditions, but they want to see them in gradebook at ALL times (if you remove role==unenrol users/grades disappear!, subscriptions are lost, group membership is gone). This is not about removing roles, this is about restricting of access to course imo. The time bases roles could be used for example to specify a date range when students may add glossary entries, you would crate a separate role without course:view assigned at module level only. If this gets implemented with current role based enrolments I would vote loudly to allow timestart/end only for roles without the course:view capability enabled (those can not be used for enrolment). What I really want is the separation of course enrolment from role assignments, multiple enrolment plugins of the same type in one course, elimination of the negative legacy guest capability (if you get it somehow, there is no way to get rid of it), global group enrolment, etc. Improved performance would be just a nice by product. Please could we redesign the enrollment framework first, I am sure several current long standing problems would disappear. I agree that enrolment needs to be rethought.
However, that is not a good reason for ignoring this bug. We have current UI for setting up timed enrolments, and we have all this data in the databse, and then accesslib just ignores it. That is a bug. Bugs should be fixed, and all the hard work on this is nearly finished. When you come to rethink enrolments, then surely it is easier to start from a place with fewer bugs, rather than starting from a baseline where things work inconsistently. Oh, and it would be really great if you could summarise your thoughts about enrolments on Moodle docs. Then allow several weeks for discussions in general developer, roles and capabilities, and enrolment forums before you want to start writing code.
Whenever I do manage to get a good discussion going about something I am working on, I am always surprised at how many good ideas I get, even when I already think I know all the answers. Further refined patch:
1. Confirming we don't need any code in backup/restore, because restore uses the role_assign function, which initialises the active field properly. 2. admin/generator.php was touching the role_assignments table directly, rather than using role_assign(). Fixed in a separate commit. 3. There are some refererences to the role_assignments table outside accesslib.php, which sam missed. I'm fixing those queries that need it. Wow! there were a lot. 4. upgrade.php code redone to use 2.0 XMLDB functions. 5. We are not creating an index on the role_assignements.active field. That seems OK to me. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||