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

enroll_lti module does not assign roles to participants of a course

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.5.2
    • Fix Version/s: None
    • Component/s: Enrolments
    • Labels:
      None
    • Affected Branches:
      MOODLE_35_STABLE

      Description

      I have some problem with LTI, when Moodle-A is the LTI Provider and Moodle-B is the LTI Consumer.
      After the LTI provider was configured for an activity module and the user from the Moodle-A falls into the activity module in the Moodle-B via LTI, that user does not get any role in the course. The problem is caused by a call of a role_assign method (which is called in onLaunch method in enrol\lti\classes\tool_provider.php file) with an invalid context id which corresponds to a module context (contextlevel=70 - MODULE_CONTEXT).

      The problem does not occur when the LTI Provider was configured for the course, because a $tool->contextid corresponds to a course context in this case.

      Code below proposes possible solution of that problem:

       // Give the user the role in the given context.
       $roleid = $isinstructor ? $tool->roleinstructor : $tool->rolelearner;
       if($context->contextlevel==CONTEXT_MODULE)
         $courseContext=\context_course::instance($cm->course,MUST_EXIST);
       else if ($context->contextlevel == CONTEXT_COURSE)
         $courseContext=\context_course::instance($courseid,MUST_EXIST);
       role_assign($roleid, $user->id, $courseContext->id);
       //role_assign($roleid, $user->id, $tool->contextid);

      Also, i don't understand why course members syncronization via the IMS LTI Membership Service, which is a part of both the LTI Provider and the LTI Consumer, enrolls members to the course but does not assign roles to that members in the course. Groups and enrollments to the groups are not created in the course too. Please solve this problem.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bbdev2 BBdev2
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: