Moodle
  1. Moodle
  2. MDL-29306

User with multiple requested roles is enrolled only with one role

    Details

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

      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.

        Activity

        Hide
        Petr Škoda added a comment -

        thanks for the report!

        Show
        Petr Škoda added a comment - thanks for the report!
        Hide
        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
        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
        Aparup Banerjee added a comment -

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

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

        YTC !

        (aka, yay, thanks and ciao ) Closing.

        Show
        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: