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

User with multiple requested roles is enrolled only with one role

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1, 2.1.1
    • Fix Version/s: 2.1.2
    • Component/s: Enrolments
    • Labels:

      Description

      The external database enrolment plugin contains a sync script which seem to contain a bug.

      When a user in the external database has multiple roles in the same course, the script enrols this user with only one role.

      The bug seems to be located on line 442 in the file /enrol/database/lib.php in function sync_enrolments()

      I believe that the following condition:

      if (empty($current_roles[$userid]))

      should be replaced by:

      if (empty($current_roles[$userid][roleid]))

      Thanks for confirming and fixing this bug.

        Gliffy Diagrams

          Activity

          Hide
          skodak Petr Skoda added a comment -

          thanks for the report!

          Show
          skodak Petr Skoda added a comment - thanks for the report!
          Hide
          samhemelryk Sam Hemelryk added a comment -

          Thanks Petr, this has been integrated now.

          One question however should this be backported to MOODLE_20_STABLE? I had a quick look and it appears that the same 21 patch would be applicable.

          Cheers
          Sam

          Show
          samhemelryk Sam Hemelryk added a comment - Thanks Petr, this has been integrated now. One question however should this be backported to MOODLE_20_STABLE? I had a quick look and it appears that the same 21 patch would be applicable. Cheers Sam
          Hide
          nebgor Aparup Banerjee added a comment -

          this seems to work for me. i'm getting multiple roles with the enrolment.

          Show
          nebgor Aparup Banerjee added a comment - this seems to work for me. i'm getting multiple roles with the enrolment.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          YTC !

          (aka, yay, thanks and ciao ) Closing.

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - YTC ! (aka, yay, thanks and ciao ) Closing.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Oct/11