Moodle
  1. Moodle
  2. MDL-21782

Major 2.0 enrolments rewrite META

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 2.0
    • Component/s: Enrolments, Roles / Access
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      15637

      Description

      Spec:

      This is a meta bug describing all necessary steps. Issues marked as work-in-progress are implemented in my patch. We are looking for volunteers to work on issues assigned to 'nobody'

      1. enrol20_10.patch
        631 kB
        Petr Škoda
      2. enrol20_6.patch
        588 kB
        Petr Škoda
      3. enrol20.patch
        593 kB
        Petr Škoda
      4. Participants (A).bmml
        5 kB
        Martin Dougiamas
      1. Participants (A).png
        119 kB

        Issue Links

        Progress
        Resolved Sub-Tasks

        Sub-Tasks

        1.
        New enrolment infrastructure Sub-task Closed Petr Škoda
         
        2.
        Change meaning of course_categories.visible Sub-task Closed Petr Škoda
         
        3.
        upgrade enrol/authorize plugin Sub-task Closed Aaron Barnes
         
        4.
        new enrol/category plugin Sub-task Closed Petr Škoda
         
        5.
        new enrol/cohort plugin Sub-task Closed Petr Škoda
         
        6.
        upgrade enrol/database plugin Sub-task Closed Petr Škoda
         
        7.
        upgrade enrol/flatfile plugin Sub-task Closed Aaron Barnes
         
        8.
        new enrol/guest plugin Sub-task Closed Petr Škoda
         
        9.
        upgrade enrol/imsenterprise plugin Sub-task Closed Aaron Barnes
         
        10.
        upgrade enrol/ldap plugin Sub-task Closed Iñaki Arenaza
         
        11.
        upgrade enrol/manual plugin Sub-task Closed Petr Škoda
         
        12.
        new enrol/meta plugin Sub-task Closed Petr Škoda
         
        13.
        upgrade enrol/mnet plugin Sub-task Closed David Mudrak
         
        14.
        upgrade enrol/paypal plugin Sub-task Closed Aaron Barnes
         
        15.
        new enrol/self plugin Sub-task Closed Petr Škoda
         
        16.
        Enrolled users overview page Sub-task Closed Petr Škoda
         
        17.
        Enrol instances management UI Sub-task Closed Petr Škoda
         
        18.
        Enrol plugins settings and management Sub-task Closed Petr Škoda
         
        19.
        Backup of enrol tables Sub-task Closed Petr Škoda
         
        20.
        Restore of enrolment data Sub-task Closed Petr Škoda
         
        21.
        New course info details logic/icons Sub-task Closed Rossiani Wijaya
         
        22.
        Upgrade all places that deal with my courses Sub-task Closed Petr Škoda
         
        23.
        Review course completion compatibility with new enrol internals Sub-task Closed Aaron Barnes
         
        24.
        test, test, test enrol upgrade Sub-task Closed Petr Škoda
         
        25.
        Upgrade stats code to use new enrol tables Sub-task Closed Petr Škoda
         
        26.
        enrol related webservices Sub-task Closed Petr Škoda
         
        27.
        enrolment related events Sub-task Closed Petr Škoda
         
        28.
        Add AJAX and more features to the main enrolment overview Sub-task Closed Sam Hemelryk
         
        29.
        UI for not-enrolled users with a role in the course Sub-task Closed Sam Hemelryk
         
        30.
        Add one time cohort enrol UI Sub-task Closed Sam Hemelryk
         
        31.
        review course request - add new enrol logic there when auto confirming Sub-task Closed Petr Škoda
         
        32.
        Enrolment help strings Sub-task Closed David Mudrak
         
        33.
        add total count to Enrol overview page Sub-task Closed Sam Hemelryk
         
        34.
        enrol UI ajax must explicitly ask each enrol plugin instance if manual enrol allowed Sub-task Closed Sam Hemelryk
         
        35.
        Move enrolment instance configuration to the enrolment overview page Sub-task Closed Petr Škoda
         
        36.
        reimplement missing longtimenosee unenrol support Sub-task Closed Petr Škoda
         

          Activity

          Hide
          Petr Škoda added a comment -
          Show
          Petr Škoda added a comment - you can review code at: http://github.com/skodak/moodle/compare/cvshead...enrol#files_bucket
          Hide
          Petr Škoda added a comment -

          Missing bits:

          • cohort enrol plugin - tomorrow
          • meta course enrol plugin - tomorrow
          • missing "Enrol" and "Unenrol" links in navigation - tomorrow
          • specs and description - tomorrow
          • all complex plugins (ldap, paypal, etc.) - later
          Show
          Petr Škoda added a comment - Missing bits: cohort enrol plugin - tomorrow meta course enrol plugin - tomorrow missing "Enrol" and "Unenrol" links in navigation - tomorrow specs and description - tomorrow all complex plugins (ldap, paypal, etc.) - later
          Hide
          Petr Škoda added a comment -

          Short list of changes:

          • new "enrol" table - contains instances of enrol plugins in each course, several fields were migrated from course table there
          • new "course_participants" table - contains course enrolment info
          • role_assignments table simplified - only roles there, "enrol" renamed to "component" so that we may distinguish auth/enrol finally
          • new enrol_get_my_courses() and enrol_get_users_courses()
          • improved require_login() - faster, more reliable and optionally throws exception instead of redirects
          • $CFG->coursemanager renamed to coursecontact - hopefull it will prevent some confusion
          • /enrol/xxx/ + enrollib.php completely rewritten - a lot of refactoring, very little hardcoding in core - new self, guest, cohort, meta
          • role_assign(), role_unassign() and role_unassign_all() reworked - faster and safer to use
          • course category visiblity is not used only for browsing of courses, it is not tested in require_login() any more - it is roughly equivalent to previous $CFG->allowvisiblecoursesinhiddencategories (need review of course category UI)
          • ....
          Show
          Petr Škoda added a comment - Short list of changes: new "enrol" table - contains instances of enrol plugins in each course, several fields were migrated from course table there new "course_participants" table - contains course enrolment info role_assignments table simplified - only roles there, "enrol" renamed to "component" so that we may distinguish auth/enrol finally new enrol_get_my_courses() and enrol_get_users_courses() improved require_login() - faster, more reliable and optionally throws exception instead of redirects $CFG->coursemanager renamed to coursecontact - hopefull it will prevent some confusion /enrol/xxx/ + enrollib.php completely rewritten - a lot of refactoring, very little hardcoding in core - new self, guest, cohort, meta role_assign(), role_unassign() and role_unassign_all() reworked - faster and safer to use course category visiblity is not used only for browsing of courses, it is not tested in require_login() any more - it is roughly equivalent to previous $CFG->allowvisiblecoursesinhiddencategories (need review of course category UI) ....
          Hide
          Petr Škoda added a comment -

          snapshots can be downloaded from http://github.com/skodak/moodle/downloads

          Show
          Petr Škoda added a comment - snapshots can be downloaded from http://github.com/skodak/moodle/downloads
          Hide
          Petr Škoda added a comment -

          added ENROL_REVIEW_2 snapshot - upgrade mostly implemented, cohort and meta course plugins work now, more core changes and cleanup, etc.

          Show
          Petr Škoda added a comment - added ENROL_REVIEW_2 snapshot - upgrade mostly implemented, cohort and meta course plugins work now, more core changes and cleanup, etc.
          Hide
          Petr Škoda added a comment -

          adding latest patch, tagged ENROL_PREVIEW_3

          Show
          Petr Škoda added a comment - adding latest patch, tagged ENROL_PREVIEW_3
          Hide
          Petr Škoda added a comment - - edited

          grrr, ignore the patch, here are full download urls http://github.com/skodak/moodle/downloads again

          Show
          Petr Škoda added a comment - - edited grrr, ignore the patch, here are full download urls http://github.com/skodak/moodle/downloads again
          Hide
          Martin Dougiamas added a comment - - edited

          The key confusion is between the "Assigned roles" and the "Manual enrolments", obviously, mostly because they are independent, and the 'Assigned roles' screen contains people who are both participants and non-participants.

          My GUI idea is that we get rid of the generic assigned roles screen totally, and change the distinction to enrolled participants and non-enrolled participants, with separate pages.

          A. ENROLLED PEOPLE

          The manual enrolment screen should be changed to a name like "Active course participants", which is all the people who are actively involved and seen in the course. It could even be integrated with the under/index.php page but doesn't have to be. Basically it's a table with paging and firstname/lastname selectors. Columns are: profile image, name, email etc, enrolment method, and roles.

          A selector box (like the right hand of the old assign roles screen) lets you manually assign lots of people to this page, and there are X icons to remove them (as well as checkboxes for multiselect).

          The enrolment column lists names of ALL the enrolment methods that led to a user being here. Of course, any added with the selector box here would be "manual" or "added by teacher". If a non-manual method is active for any user then you would not be allowed to remove them here.

          The roles column would work like the roles column does on the permissions screen. You can add/remove roles here easily with an AJAX popup menu.

          B. NON-ENROLLED PEOPLE

          Since these are less common, and likely to be very few people, we can have a separate page for them. It's a paged table similar to the above, except it will be very clear that these people are not enrolled no matter what permissions they have. It would make sense to go here to add an observer teacher, or a supervisor, for example.

          We can show inherited users from higher contexts here too, with information about exactly what context they are enrolled in.

          C. MENU STRUCTURE AND OTHER STUFF

          I think it's best for the manual enrolment to be integrated in the main overview as above, rather than appear as a plugin like all the other ones. It's special. We do still need to have configuration pages for all the other plugins, of course. However, these are not things you visit often, so don't need to be so prominent.

          We can also move the settings from the course settings screen to settings menu. (I'm not sure about this, because I do like your forms there, but it's also good to keep this all clear in the menus with less mega-forms).

          Course Administration
          Enrolments

          • Participants (---> A)
          • Other people (---->B)
          • Enrolment methods (menu)
          • - Manage enrolment methods (enable/disable any of them, plus settings links to below)
          • - Manual enrolments (-> page to set default role etc)
          • - Guest access (-> page to set password etc)
          • - Self enrolment (-> page to set password, role, days etc)
          • - Cohort enrolment
          • - etc
          Show
          Martin Dougiamas added a comment - - edited The key confusion is between the "Assigned roles" and the "Manual enrolments", obviously, mostly because they are independent, and the 'Assigned roles' screen contains people who are both participants and non-participants. My GUI idea is that we get rid of the generic assigned roles screen totally, and change the distinction to enrolled participants and non-enrolled participants, with separate pages. A. ENROLLED PEOPLE The manual enrolment screen should be changed to a name like "Active course participants", which is all the people who are actively involved and seen in the course. It could even be integrated with the under/index.php page but doesn't have to be. Basically it's a table with paging and firstname/lastname selectors. Columns are: profile image, name, email etc, enrolment method, and roles. A selector box (like the right hand of the old assign roles screen) lets you manually assign lots of people to this page, and there are X icons to remove them (as well as checkboxes for multiselect). The enrolment column lists names of ALL the enrolment methods that led to a user being here. Of course, any added with the selector box here would be "manual" or "added by teacher". If a non-manual method is active for any user then you would not be allowed to remove them here. The roles column would work like the roles column does on the permissions screen. You can add/remove roles here easily with an AJAX popup menu. B. NON-ENROLLED PEOPLE Since these are less common, and likely to be very few people, we can have a separate page for them. It's a paged table similar to the above, except it will be very clear that these people are not enrolled no matter what permissions they have. It would make sense to go here to add an observer teacher, or a supervisor, for example. We can show inherited users from higher contexts here too, with information about exactly what context they are enrolled in. C. MENU STRUCTURE AND OTHER STUFF I think it's best for the manual enrolment to be integrated in the main overview as above, rather than appear as a plugin like all the other ones. It's special. We do still need to have configuration pages for all the other plugins, of course. However, these are not things you visit often, so don't need to be so prominent. We can also move the settings from the course settings screen to settings menu. (I'm not sure about this, because I do like your forms there, but it's also good to keep this all clear in the menus with less mega-forms). Course Administration Enrolments Participants (---> A) Other people (---->B) Enrolment methods (menu) - Manage enrolment methods (enable/disable any of them, plus settings links to below) - Manual enrolments (-> page to set default role etc) - Guest access (-> page to set password etc) - Self enrolment (-> page to set password, role, days etc) - Cohort enrolment - etc
          Hide
          Martin Dougiamas added a comment -

          Added UI Mockup: <Participants (A)>

          Show
          Martin Dougiamas added a comment - Added UI Mockup: <Participants (A)>
          Hide
          Petr Škoda added a comment -

          I have tagged preview 4 on github, it contains some of the proposed changes above, namely main enrol overview page that lists all users.

          Show
          Petr Škoda added a comment - I have tagged preview 4 on github, it contains some of the proposed changes above, namely main enrol overview page that lists all users.
          Hide
          Petr Škoda added a comment -

          ENROL_PREVIEW_7 tagged, I am planning more testing tomorrow, but it is getting really close to commit quality, the docs and list of subtasks were updated too
          please note upgrade is not possible from any previous PREVIEW - reinstall or upgrade from latest CVS

          Show
          Petr Škoda added a comment - ENROL_PREVIEW_7 tagged, I am planning more testing tomorrow, but it is getting really close to commit quality, the docs and list of subtasks were updated too please note upgrade is not possible from any previous PREVIEW - reinstall or upgrade from latest CVS
          Hide
          Martin Dougiamas added a comment -

          I tried to upgrade http://school.demo.moodle.net from latest CVS because we really need to set up enrolments properly there before Friday and had these issues:

          1/ course_category typo in lib/db/upgrade.php (should be course_categories)
          2/ The version numbers are all based on 2010052900 and HEAD has moved on to 2010060800
          3/ After fixing those, got:

          Debug info: Duplicate entry '10-135' for key 'mdl_userenro_enruse_uix'
          INSERT INTO mdl_user_enrolments (status, enrolid, userid, timestart, timeend, modifierid, timemodified)

          SELECT 0, e.id, ra.userid, ra.timestart, ra.timeend, ra.modifierid, ra.timemodified
          FROM mdl_role_assignments ra
          JOIN mdl_context c ON (c.id = ra.contextid AND c.contextlevel = 50)
          JOIN mdl_enrol e ON (e.enrol = ra.enrol AND e.courseid = c.instanceid)
          JOIN mdl_user u ON u.id = ra.userid
          WHERE u.deleted = 0 AND ra.roleid IN (?,?,?)
          [array (
          0 => '5',
          1 => '4',
          2 => '3',
          )]
          Stack trace:

          • line 381 of /lib/dml/moodle_database.php: dml_write_exception thrown
          • line 545 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
          • line 4634 of /lib/db/upgrade.php: call to mysqli_native_moodle_database->execute()
          • line 1241 of /lib/upgradelib.php: call to xmldb_main_upgrade()
          • line 248 of /admin/index.php: call to upgrade_core()

          Gave up for now to work on something else.

          Show
          Martin Dougiamas added a comment - I tried to upgrade http://school.demo.moodle.net from latest CVS because we really need to set up enrolments properly there before Friday and had these issues: 1/ course_category typo in lib/db/upgrade.php (should be course_categories) 2/ The version numbers are all based on 2010052900 and HEAD has moved on to 2010060800 3/ After fixing those, got: Debug info: Duplicate entry '10-135' for key 'mdl_userenro_enruse_uix' INSERT INTO mdl_user_enrolments (status, enrolid, userid, timestart, timeend, modifierid, timemodified) SELECT 0, e.id, ra.userid, ra.timestart, ra.timeend, ra.modifierid, ra.timemodified FROM mdl_role_assignments ra JOIN mdl_context c ON (c.id = ra.contextid AND c.contextlevel = 50) JOIN mdl_enrol e ON (e.enrol = ra.enrol AND e.courseid = c.instanceid) JOIN mdl_user u ON u.id = ra.userid WHERE u.deleted = 0 AND ra.roleid IN (?,?,?) [array ( 0 => '5', 1 => '4', 2 => '3', )] Stack trace: line 381 of /lib/dml/moodle_database.php: dml_write_exception thrown line 545 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end() line 4634 of /lib/db/upgrade.php: call to mysqli_native_moodle_database->execute() line 1241 of /lib/upgradelib.php: call to xmldb_main_upgrade() line 248 of /admin/index.php: call to upgrade_core() Gave up for now to work on something else.
          Hide
          Petr Škoda added a comment -

          oops, should be fixed now together with some other mysql problems, new ENROL_PREVIEW_8 tagged - continuing tests on real backup data from several production servers....

          Show
          Petr Škoda added a comment - oops, should be fixed now together with some other mysql problems, new ENROL_PREVIEW_8 tagged - continuing tests on real backup data from several production servers....
          Hide
          Fernando Oliveira added a comment -

          Hi Petr,

          I'm quite interested in this feature and am able to do some testing and provide feedback (if you'd find it helpful at this stage of the game). Is the lastest code availabe on http://github.com/skodak/moodle/downloads?

          Show
          Fernando Oliveira added a comment - Hi Petr, I'm quite interested in this feature and am able to do some testing and provide feedback (if you'd find it helpful at this stage of the game). Is the lastest code availabe on http://github.com/skodak/moodle/downloads?
          Hide
          Dan Poltawski added a comment -

          Was playing on the git repo branch and tried to unenrol a manally enrolled user:

          Fatal error: Call to undefined function coding_exception() in /var/www/moodle/lib/enrollib.php on line 877 Call Stack: 0.0018 558748 1.

          {main}

          () /var/www/moodle/enrol/users.php:0 0.2880 22195440 2. enrol_plugin->unenrol_user() /var/www/moodle/enrol/users.php:114 0.2913 22197540 3. events_trigger() /var/www/moodle/lib/enrollib.php:901 0.2922 22199544 4. events_dispatch() /var/www/moodle/lib/eventslib.php:438 0.2930 22282772 5. call_user_func() /var/www/moodle/lib/eventslib.php:243 0.2930 22283092 6. enrol_meta_handler::user_unenrolled() /var/www/moodle/lib/eventslib.php:0 0.2970 22313416 7. enrol_plugin->unenrol_user() /var/www/moodle/enrol/meta/locallib.php:164

          Show
          Dan Poltawski added a comment - Was playing on the git repo branch and tried to unenrol a manally enrolled user: Fatal error: Call to undefined function coding_exception() in /var/www/moodle/lib/enrollib.php on line 877 Call Stack: 0.0018 558748 1. {main} () /var/www/moodle/enrol/users.php:0 0.2880 22195440 2. enrol_plugin->unenrol_user() /var/www/moodle/enrol/users.php:114 0.2913 22197540 3. events_trigger() /var/www/moodle/lib/enrollib.php:901 0.2922 22199544 4. events_dispatch() /var/www/moodle/lib/eventslib.php:438 0.2930 22282772 5. call_user_func() /var/www/moodle/lib/eventslib.php:243 0.2930 22283092 6. enrol_meta_handler::user_unenrolled() /var/www/moodle/lib/eventslib.php:0 0.2970 22313416 7. enrol_plugin->unenrol_user() /var/www/moodle/enrol/meta/locallib.php:164
          Hide
          Petr Škoda added a comment -

          Hi,
          thanks for testing, the latest ENROL_PREVIEW_9 should install and upgrade fine, the incorrect exception throwing is fixed too.

          Petr

          Show
          Petr Škoda added a comment - Hi, thanks for testing, the latest ENROL_PREVIEW_9 should install and upgrade fine, the incorrect exception throwing is fixed too. Petr
          Hide
          Martin Dougiamas added a comment -

          I'm starting on Patch 9 review right now. Will post back here shortly.

          Show
          Martin Dougiamas added a comment - I'm starting on Patch 9 review right now. Will post back here shortly.
          Hide
          Martin Dougiamas added a comment - - edited

          My current thoughts on the UI, which I'm feeling very sure about now.

          Course Administration

          • Turn editing on
          • Settings
          • Participants (menu, probably no link)
            • Enrolled participants (-> current page in patch, enrol/users.php A)
            • Other participants (-> new page showing users who are not enrolled but have some roles, course/users.php? B)
            • Enrolment methods (-> current enrol/instances.php manage/enable/disable any of the plugin instances, plus settings links to each instance below)
              • Manual enrolments (-> new page to set default role etc, can also have left/right assign interface if you really want it)
              • Guest access (-> new page to set password etc)
              • Self enrolment (-> new page to set password, role, days etc)
              • Cohort enrolment (-> new page to choose cohort etc)
            • Groups (-> normal group pages)
            • Permissions (-> current admin/roles/permissions.php)
              • Check permissions (-> current admin/roles/check.php)
          • Grades
          • Backup
          • Restore
          • Import
          • Publish
          • Reset
          • Question bank
          Show
          Martin Dougiamas added a comment - - edited My current thoughts on the UI, which I'm feeling very sure about now. Course Administration Turn editing on Settings Participants (menu, probably no link) Enrolled participants (-> current page in patch, enrol/users.php A) Other participants (-> new page showing users who are not enrolled but have some roles, course/users.php? B) Enrolment methods (-> current enrol/instances.php manage/enable/disable any of the plugin instances, plus settings links to each instance below) Manual enrolments (-> new page to set default role etc, can also have left/right assign interface if you really want it) Guest access (-> new page to set password etc) Self enrolment (-> new page to set password, role, days etc) Cohort enrolment (-> new page to choose cohort etc) Groups (-> normal group pages) Permissions (-> current admin/roles/permissions.php) Check permissions (-> current admin/roles/check.php) Grades Backup Restore Import Publish Reset Question bank
          Hide
          Martin Dougiamas added a comment -

          Apart from that I haven't bumped into any actual issues yet. If you are feeling good about upgrades then I think you should put it in CVS.

          Show
          Martin Dougiamas added a comment - Apart from that I haven't bumped into any actual issues yet. If you are feeling good about upgrades then I think you should put it in CVS.
          Hide
          Petr Škoda added a comment - - edited

          I still do not like the way you use "Participants" - if you have some kind of course manager or inspector he is not a participant.

          Course Administration

          • Turn editing on
          • Settings
          • Users (menu, probably no link)
            • Enrolled participants (-> current page in patch, enrol/users.php A)
            • Enrolment methods (-> current enrol/instances.php manage/enable/disable any of the plugin instances, plus settings links to each instance below)
              • Manual enrolments (-> new page to set default role etc, can also have left/right assign interface if you really want it)
              • Temporary guest access (-> new page to set password etc) - all types of guest access on one page
              • Self enrolment (-> new page to set password, role, days etc) - al types of self enrolment in one course
              • Cohort enrolment (-> new page to choose cohort etc) - this should include all cohort syncs - table with cohort -> role & group rows
            • Groups (-> normal group pages)
            • Other users (-> new page showing users who are not enrolled but have some roles, course/users.php? B)
            • Permissions (-> current admin/roles/permissions.php)
              • Check permissions (-> current admin/roles/check.php)
              • Role assignments (-> current admin/role/assign.php) - for admins only!
          • Grades
          • Backup
          • Restore
          • Import
          • Publish
          • Reset
          • Question bank

          I think it would be better to keep current possibility to edit basic guess, self and manual settings on the course edit page - maybe we could remove all advanced fields there, ok?

          edit: moving other users a bit down because groups are for enrolled only

          Show
          Petr Škoda added a comment - - edited I still do not like the way you use "Participants" - if you have some kind of course manager or inspector he is not a participant. Course Administration Turn editing on Settings Users (menu, probably no link) Enrolled participants (-> current page in patch, enrol/users.php A) Enrolment methods (-> current enrol/instances.php manage/enable/disable any of the plugin instances, plus settings links to each instance below) Manual enrolments (-> new page to set default role etc, can also have left/right assign interface if you really want it) Temporary guest access (-> new page to set password etc) - all types of guest access on one page Self enrolment (-> new page to set password, role, days etc) - al types of self enrolment in one course Cohort enrolment (-> new page to choose cohort etc) - this should include all cohort syncs - table with cohort -> role & group rows Groups (-> normal group pages) Other users (-> new page showing users who are not enrolled but have some roles, course/users.php? B) Permissions (-> current admin/roles/permissions.php) Check permissions (-> current admin/roles/check.php) Role assignments (-> current admin/role/assign.php) - for admins only! Grades Backup Restore Import Publish Reset Question bank I think it would be better to keep current possibility to edit basic guess, self and manual settings on the course edit page - maybe we could remove all advanced fields there, ok? edit: moving other users a bit down because groups are for enrolled only
          Hide
          Martin Dougiamas added a comment - - edited

          Participants makes sense to me more than just enrolled ... it's people who come to this course. Users is OK too, but it's different to the participants in the Nav menu. But it's ok, I can live with that.

          Still not keen on keeping enrolment instance setup in the course settings page ... better to redirect to enrolment instance management screen directly after first course setup and then just have one consistent place these things are set.

          But I feel we definitely can not have Role assignments anywhere for anyone at course level. It's way too confusing and why I replaced it with B.

          Show
          Martin Dougiamas added a comment - - edited Participants makes sense to me more than just enrolled ... it's people who come to this course. Users is OK too, but it's different to the participants in the Nav menu. But it's ok, I can live with that. Still not keen on keeping enrolment instance setup in the course settings page ... better to redirect to enrolment instance management screen directly after first course setup and then just have one consistent place these things are set. But I feel we definitely can not have Role assignments anywhere for anyone at course level. It's way too confusing and why I replaced it with B.
          Hide
          Petr Škoda added a comment -

          1/ ok, let's kill the assign roles at course context completely
          2/ I think that at least manual and guest access should be on course edit page - but the rest can be moved to separate settings page, the current architecture allows this

          Show
          Petr Škoda added a comment - 1/ ok, let's kill the assign roles at course context completely 2/ I think that at least manual and guest access should be on course edit page - but the rest can be moved to separate settings page, the current architecture allows this
          Hide
          Petr Škoda added a comment -

          hmm, I am still working on upgrades - so far I did not find the reason for duplicated enrol instances, sorry

          Show
          Petr Škoda added a comment - hmm, I am still working on upgrades - so far I did not find the reason for duplicated enrol instances, sorry
          Hide
          Petr Škoda added a comment -

          arrgh, the sql dump you sent me went already through several repeated upgrades, that default if (!db exists) stuff in upgrade only hides the real problems....

          Show
          Petr Škoda added a comment - arrgh, the sql dump you sent me went already through several repeated upgrades, that default if (!db exists) stuff in upgrade only hides the real problems....
          Hide
          Martin Dougiamas added a comment -

          I asked Jordan to send you the dump from before the enrol upgrade ... possibly he sent the one after the upgrade?

          Show
          Martin Dougiamas added a comment - I asked Jordan to send you the dump from before the enrol upgrade ... possibly he sent the one after the upgrade?
          Hide
          Jay Knight added a comment -

          This little error seems to have been introduced by the commit from 6/21 (http://github.com/moodle/moodle/commit/df997f841f93d676d782a46cfb8547ebc7319102): MDL-23255

          Show
          Jay Knight added a comment - This little error seems to have been introduced by the commit from 6/21 ( http://github.com/moodle/moodle/commit/df997f841f93d676d782a46cfb8547ebc7319102): MDL-23255
          Hide
          Jay Knight added a comment -

          Getting an error when user is enrolled in a hidden courses and views the home page:

          Fatal error: Cannot use object of type stdClass as array in /..../html/moodle2/lib/enrollib.php on line 509

          Originates with http://github.com/moodle/moodle/commit/df997f841f93d676d782a46cfb8547ebc7319102 ?

          Changing the unset($course['id']) lines to unset($course->id) fixed that problem, but there are others when the user clicks the link to the hidden course.

          Show
          Jay Knight added a comment - Getting an error when user is enrolled in a hidden courses and views the home page: Fatal error: Cannot use object of type stdClass as array in /..../html/moodle2/lib/enrollib.php on line 509 Originates with http://github.com/moodle/moodle/commit/df997f841f93d676d782a46cfb8547ebc7319102 ? Changing the unset($course ['id'] ) lines to unset($course->id) fixed that problem, but there are others when the user clicks the link to the hidden course.
          Hide
          Petr Škoda added a comment -

          thanks for the report, it should be fixed now

          Show
          Petr Škoda added a comment - thanks for the report, it should be fixed now
          Hide
          Jay Knight added a comment -

          Awesome... But, It looks like the same change needs to be made on 615 and 619

          Show
          Jay Knight added a comment - Awesome... But, It looks like the same change needs to be made on 615 and 619
          Hide
          Petr Škoda added a comment -

          arrggh, fixed, thanks again

          Show
          Petr Škoda added a comment - arrggh, fixed, thanks again
          Hide
          Tina Schaefer added a comment -

          Hi there,

          I have come across the same error that was mentioned earlier in this post. See below.

          How can I fix this?

          Thanks
          Tina

          ---------------------------------
          Debug info: Duplicate entry '2-11' for key 'mdl_userenro_enruse_uix'
          INSERT INTO mdl_user_enrolments (status, enrolid, userid, timestart, timeend, modifierid, timecreated, timemodified)

          SELECT 0, e.id, ra.userid, MIN(ra.timestart), MIN(ra.timeend), 0, MIN(ra.timemodified), MAX(ra.timemodified)
          FROM mdl_role_assignments ra
          JOIN mdl_context c ON (c.id = ra.contextid AND c.contextlevel = 50)
          JOIN mdl_enrol e ON (e.enrol = ra.enrol AND e.courseid = c.instanceid)
          JOIN mdl_user u ON u.id = ra.userid
          WHERE u.deleted = 0 AND ra.roleid IN (?,?,?)
          GROUP BY e.id, ra.userid
          [array (
          0 => '5',
          1 => '4',
          2 => '3',
          )]
          Stack trace:

          • line 394 of \lib\dml\moodle_database.php: dml_write_exception thrown
          • line 672 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end()
          • line 4320 of \lib\db\upgrade.php: call to mysqli_native_moodle_database->execute()
          • line 1309 of \lib\upgradelib.php: call to xmldb_main_upgrade()
          • line 252 of \admin\index.php: call to upgrade_core()
          Show
          Tina Schaefer added a comment - Hi there, I have come across the same error that was mentioned earlier in this post. See below. How can I fix this? Thanks Tina --------------------------------- Debug info: Duplicate entry '2-11' for key 'mdl_userenro_enruse_uix' INSERT INTO mdl_user_enrolments (status, enrolid, userid, timestart, timeend, modifierid, timecreated, timemodified) SELECT 0, e.id, ra.userid, MIN(ra.timestart), MIN(ra.timeend), 0, MIN(ra.timemodified), MAX(ra.timemodified) FROM mdl_role_assignments ra JOIN mdl_context c ON (c.id = ra.contextid AND c.contextlevel = 50) JOIN mdl_enrol e ON (e.enrol = ra.enrol AND e.courseid = c.instanceid) JOIN mdl_user u ON u.id = ra.userid WHERE u.deleted = 0 AND ra.roleid IN (?,?,?) GROUP BY e.id, ra.userid [array ( 0 => '5', 1 => '4', 2 => '3', )] Stack trace: line 394 of \lib\dml\moodle_database.php: dml_write_exception thrown line 672 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end() line 4320 of \lib\db\upgrade.php: call to mysqli_native_moodle_database->execute() line 1309 of \lib\upgradelib.php: call to xmldb_main_upgrade() line 252 of \admin\index.php: call to upgrade_core()
          Hide
          Petr Škoda added a comment -

          Hello,
          did you upgrade from 1.9.x to final 2.0 or did you go through some alpha or RC versions?

          Show
          Petr Škoda added a comment - Hello, did you upgrade from 1.9.x to final 2.0 or did you go through some alpha or RC versions?
          Hide
          Tina Schaefer added a comment -

          Hi Petr,

          I upgraded from 1.9.9 to final 2.0+. I was able to fix the issue by manually changing the 'mdl_userenro_enruse_uix' index in my database to 'Normal' - it was set to 'Unique' originally.

          Best, Tina

          Show
          Tina Schaefer added a comment - Hi Petr, I upgraded from 1.9.9 to final 2.0+. I was able to fix the issue by manually changing the 'mdl_userenro_enruse_uix' index in my database to 'Normal' - it was set to 'Unique' originally. Best, Tina
          Hide
          Petr Škoda added a comment -

          Changing the index on any Moodle table might cause major problems later, I would not recommend that at all. Ideally somebody should diagnose the data in 1.9.x install and fix it before the upgrade.

          Show
          Petr Škoda added a comment - Changing the index on any Moodle table might cause major problems later, I would not recommend that at all. Ideally somebody should diagnose the data in 1.9.x install and fix it before the upgrade.
          Hide
          Tina Schaefer added a comment -

          After further investigation I found that all the data in the mdl_user_enrolment table has been added twice.(when I made the manual change to 'Normal'). The id stops at 76788 and restarts again at 131073 for some reason. Any idea why this may be?

          Show
          Tina Schaefer added a comment - After further investigation I found that all the data in the mdl_user_enrolment table has been added twice.(when I made the manual change to 'Normal'). The id stops at 76788 and restarts again at 131073 for some reason. Any idea why this may be?
          Hide
          Tina Schaefer added a comment -

          After further investigation I found that all the data in the mdl_user_enrolment table has been added twice.(when I made the manual change to 'Normal'). The id stops at 76788 and restarts again at 131073 for some reason. Any idea why this may be?

          Show
          Tina Schaefer added a comment - After further investigation I found that all the data in the mdl_user_enrolment table has been added twice.(when I made the manual change to 'Normal'). The id stops at 76788 and restarts again at 131073 for some reason. Any idea why this may be?
          Hide
          Chad Bergeron added a comment -

          I know this is closed, but I'm hoping someone watching this will have a little expertise I could lean on. Running an upgrade from 1.9 to 2.2 and getting the error:
          Debug info: Duplicate entry '1-2' for key 'mdl_userenro_enruse_uix'
          INSERT INTO mdl_user_enrolments (status, enrolid, userid, timestart, timeend, modifierid, timecreated, timemodified)

          SELECT 0, e.id, ra.userid, MIN(ra.timestart), MIN(ra.timeend), 0, MIN(ra.timemodified), MAX(ra.timemodified)
          FROM mdl_role_assignments ra
          JOIN mdl_context c ON (c.id = ra.contextid AND c.contextlevel = 50)
          JOIN mdl_enrol e ON (e.enrol = ra.enrol AND e.courseid = c.instanceid)
          JOIN mdl_user u ON u.id = ra.userid
          WHERE u.deleted = 0 AND ra.roleid IN (?,?,?,?,?)
          GROUP BY e.id, ra.userid
          [array (
          0 => '5',
          1 => '4',
          2 => '3',
          3 => '8',
          4 => '11',
          )]
          Stack trace:
          line 397 of \lib\dml\moodle_database.php: dml_write_exception thrown
          line 722 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end()
          line 4293 of \lib\db\upgrade.php: call to mysqli_native_moodle_database->execute()
          line 1394 of \lib\upgradelib.php: call to xmldb_main_upgrade()
          line 236 of \admin\index.php: call to upgrade_core()

          How could I go about tracking down the bad data that is causing this and fix it?

          Show
          Chad Bergeron added a comment - I know this is closed, but I'm hoping someone watching this will have a little expertise I could lean on. Running an upgrade from 1.9 to 2.2 and getting the error: Debug info: Duplicate entry '1-2' for key 'mdl_userenro_enruse_uix' INSERT INTO mdl_user_enrolments (status, enrolid, userid, timestart, timeend, modifierid, timecreated, timemodified) SELECT 0, e.id, ra.userid, MIN(ra.timestart), MIN(ra.timeend), 0, MIN(ra.timemodified), MAX(ra.timemodified) FROM mdl_role_assignments ra JOIN mdl_context c ON (c.id = ra.contextid AND c.contextlevel = 50) JOIN mdl_enrol e ON (e.enrol = ra.enrol AND e.courseid = c.instanceid) JOIN mdl_user u ON u.id = ra.userid WHERE u.deleted = 0 AND ra.roleid IN (?,?,?,?,?) GROUP BY e.id, ra.userid [array ( 0 => '5', 1 => '4', 2 => '3', 3 => '8', 4 => '11', )] Stack trace: line 397 of \lib\dml\moodle_database.php: dml_write_exception thrown line 722 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end() line 4293 of \lib\db\upgrade.php: call to mysqli_native_moodle_database->execute() line 1394 of \lib\upgradelib.php: call to xmldb_main_upgrade() line 236 of \admin\index.php: call to upgrade_core() How could I go about tracking down the bad data that is causing this and fix it?
          Hide
          Martin Dougiamas added a comment - - edited

          Chad, this is not really a good place for support. You should try http://moodle.org/mod/forum/view.php?id=28

          (I see you have posted there but start a new discussion)

          Once you have more info about the data in your db you could file a new bug here too.

          Show
          Martin Dougiamas added a comment - - edited Chad, this is not really a good place for support. You should try http://moodle.org/mod/forum/view.php?id=28 (I see you have posted there but start a new discussion) Once you have more info about the data in your db you could file a new bug here too.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: