.. include:: /shortcuts.rstext .. index:: pair: LTI setup; Moodle .. _moodle: Setup of LTI 1.1 in Moodle ----------------------------------- You can set up Mahara in two different ways for use in Moodle: * General setup on the site level to make it easier for teachers as they won't require the technical details * Manual setup on the course level All screenshots were made with Moodle 3.5. .. _moodle_preconfigure_mahara: Preconfigure LTI for all courses to use ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Go to *Site administration → Plugins → Activity modules → External tool → Manage tools* .. figure:: /images/administration/external/moodle_external_tool_configuration.* :alt: Configure Moodle to connect to Mahara #. **Tool name**: Give a name that your teachers will recognise. #. **Tool URL**: Provide the launch URL. It consists of the base URL of your Mahara site and the following added to the end of it: ``/webservice/rest/server.php?wsfunction=module_lti_launch`` #. **Tool description**: This field is optional. Providing a description will help your teachers to identify the tool. #. **Consumer key**: Paste the consumer key from Mahara for the LTI connection that you set up earlier. #. **Shared secret**: Paste the consumer secret from Mahara for the LTI connection that you set up earlier. #. **Default launch container**: Choose 'New window' or 'Existing window'. Do not choose to embed Mahara. That will not work as you are not allowed to embed Mahara into other websites. Furthermore, it will reduce the space that you have available to work in Mahara. #. **Secure icon URL**: If you don't want to display the regular Moodle icon for external tools, you can provide a link to your favorite icon. It is recommended that you provide one that sits on your Mahara site and has the dimensions needed by Moodle for best results. #. Click the *Save changes* button to accept the configuration or the *Cancel* button if you want to abort setting up the tool. .. note:: You do not have to make changes to any of the other settings on the page. Use a preconfigured Mahara site in a course ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If Mahara was :ref:`already set up as external tool ` on the site level in Moodle, a teacher only needs to select it when adding the 'External tool' activity in Moodle. .. figure:: /images/administration/external/moodle_external_tool_preconfigured.* :alt: Choose a preconfigured Mahara instance in Moodle #. **Activity name**: Give your activity a title. #. **Preconfigured tool**: Select your Mahara instance from the drop-down menu. It may not be called 'Mahara'. Certain fields are not editable when you choose this option as they are determined by the existing site-wide configuration. .. note:: Click the *Show more...* link if you want to make some additional changes. #. **Privacy**: Tick the option 'Accept grades from the tool' if you want to be able to use the activity for the submission of a portfolio. #. Click the *Save and return to course* button to be taken back to your course page, click the *Save and display* button to launch into Mahara immediately, or click the *Cancel* button to abort adding Mahara to your course as activity. Configure Mahara in a course activity manually ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can set up the connection to Mahara also on the activity level in Moodle without having preconfigured it first on the site level. This can be beneficial if your course is the only one connecting to a specific Mahara site that other courses should not have access to. If everyone should have access to the same Mahara site, setting up a preconfiguration on the site level is advised though. .. figure:: /images/administration/external/moodle_external_tool_course_setup.* :alt: Set up Mahara as external tool in a Moodle course #. **Activity name**: Give your activity a title. #. **Activity description**: Provide a description of your activity. This field is optional. #. **Preconfigured tool**: Select 'Automatic, based on tool URL'. #. **Secure tool URL**: Provide the launch URL. It consists of the base URL of your Mahara site and the following added to the end of it: ``/webservice/rest/server.php?wsfunction=module_lti_launch`` .. note:: You could use the 'Tool URL' field, but since web services in Mahara only work over SSL (unless you have a developer instance), choosing the 'Secure tool URL' is recommended. #. **Launch container**: Choose 'New window' or 'Existing window'. Do not choose to embed Mahara. That will not work as you are not allowed to embed Mahara into other websites. Furthermore, it will reduce the space that you have available to work in Mahara. #. **Consumer key**: Paste the consumer key from Mahara for the LTI connection that you set up earlier. #. **Shared secret**: Paste the consumer secret from Mahara for the LTI connection that you set up earlier. #. **Secure icon URL**: If you don't want to display the regular Moodle icon for external tools, you can provide a link to your favorite icon. It is recommended that you provide one that sits on your Mahara site and has the dimensions needed by Moodle for best results. #. **Privacy**: Tick the option 'Accept grades from the tool' if you want to be able to use the activity for the submission of a portfolio. #. Click the *Save and return to course* button to be taken back to your course page, click the *Save and display* button to launch into Mahara immediately, or click the *Cancel* button to abort adding Mahara to your course as activity. .. note:: You do not have to make changes to any of the other settings on the page. .. _lti_assignment_setup_moodle: Set up an assignment in Moodle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #. Select to add the *External Tool* activity in Moodle. #. During the :ref:`setup ` ensure that you tick the checkbox next to 'Accept grades from the tool' under 'Privacy'. If you don't tick this checkbox, you can only authenticate to Mahara but not select a portfolio for submission. #. Click the activity name to finalize the :ref:`assessment settings `. Learners are not able to use the activity until these settings have been saved. .. _ouriginal: Similarity check with Ouriginal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :index:`It ` is possible to submit a portfolio via the assignment submission functionality in Moodle and send it to Ouriginal for similarity checks. This requires that both the Mahara assignment submission plugin (web services) and the `Ouriginal Moodle plugin `_ are installed. The latter requires a number of changes to access the web services in Mahara. These changes have not yet been added to the public Moodle plugin code. On the Mahara side, the available functionalities are the HTML lite and the PDF lite export options. Since similarity checking software can only process certain file types, the 'lite' export allows to restrict the export to just those file types. Refer to ``htdocs/export/htmllite/lib.php`` or ``htdocs/export/pdflite/lib.php`` for the file types that will be included in the export via the variable ``$validfiles``. **The PDF lite export is a proof of concept and an experimental feature at this stage.** #. Make sure that the normal HTML export is enabled, as it is a prerequisite for HTML lite to work. If you use the PDF lite option, enable the regular PDF export option. #. Enable the plugin in *Administration menu → Extensions → Plugin administration → HTML Lite* by clicking the *Show* button. #. Enable incoming web service requests and select the protocol that you want to use at *Administration menu → Web services → Configuration*. #. Set up a web service on the same page: * Create a new service group and assign the function ``mahara_submission_generate_view_for_plagiarism_test`` to the group and make sure that 'Service' and 'User token access' are enabled. * Create a new service access token and select the newly created service group. #. You can now access this service from an external source, for example to access it from a terminal via cURL: .. code-block:: curl --location --request POST 'http://example.com/webservice/rest/server.php' \ -F 'views[0][viewid]="8"' \ -F 'views[0][iscollection]=0' \ -F 'views[0][submittedhost]="fakeexternalsite"' \ -F 'views[0][exporttype]="htmllite"' \ -F 'wstoken="...your generated webservice token..."' \ -F 'wsfunction="mahara_submission_generate_view_for_plagiarism_test"' .. note:: To use the PDF lite option in the cURL command, change ``views[0][exporttype]="htmllite"`` to ``views[0][exporttype]="pdflite"``. .. _moodle_lit_troubleshooting: Moodle LTI connection troubleshooting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Some people experienced `issues connecting Moodle to Mahara via LTI `_ for assignment submission. One thing to check is that hosts are not blocked by Moodle. #. Make sure you have the Mahara assignment submission plugin installed in your Moodle. #. In the Moodle code in file ``/mod/assign/submission/maharaws/classes/mahara_oauth.php``, comment out the following code. .. code-block:: if ($this->http->info['http_code'] != 200) { throw new \moodle_exception('webservice call was not successful'); } #. Add the following three lines below your commented out code: .. code-block:: echo $url; echo $method; echo $params; #. Set **Debug messages** in Moodle in *Site administration → Development* to 'DEVELOPER: extra Moodle debug messages for developers'. #. In *Site administration → General → HTTP security* remove all hosts from the 'cURL blocked hosts list'. #. Add one host at a time back to the 'cURL blocked hosts list', create a new assignment activity that connects to Mahara, and check if you get an error message. #. If you get a message like ``mahara.xxx.xxx/webservice/rest URL blocked`` then you have the host that is blocked. Remove it from the 'cURL blocked hosts list'. #. Give it a go in the activity again. #. Make sure you add or update the host on which your Mahara site runs in your ``/etc/hosts file``. .. note:: If you don't make sure that you have the correct host IP in your ``hosts`` file, you may see the following error message: "Error when connecting to Mahara web services Check that URL and OAuth credentials are correct and that there is a valid SSL certificate if HTTPS is used. Also check that the correct functions are assigned to the OAuth access." .. _moodle_lti_advantage: |new in Mahara 22.10| Setup of LTI Advantage in Moodle ------------------------------------------------------------- :index:`From ` Mahara 22.10 onwards, you can connect Moodle to Mahara via LTI 1.3 Advantage. This is an initial implementation and focuses on the login option. .. note:: The Mahara assignment submission plugin for Moodle does not yet allow an LTI 1.3 Advantage connection nor is course information shared with Mahara. Screenshots were made with Moodle 4.0 Preconfigure LTI Advantage for all courses ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Go to *Site administration → Plugins → Activity modules → External tool → Manage tools* .. figure:: /images/administration/external/moodle_external_tool_preconfigured_ltiadvantage.* :alt: Configure Moodle for use of LTI 1.3 with Mahara .. note:: URLs referred to here that need to be entered from Mahara are available on the :ref:`'Edit connection' ` screen for LTI Advantage for the connection that you set up in Mahara. #. Click the option 'Alternatively, you can configure a tool manually.' on the *Manage tools* overview page. On the resulting screen... #. **Tool name**: Give a name that your teachers will recognise. #. **Tool URL**: The 'Domain' of your Mahara site. #. **Tool description**: Add a bit of context what this tool is about. This field is optional. #. **LTI version**: Select 'LTI 1.3'. That will then display the following correct fields. #. **Public key type**: Select 'Keyset URL'. #. **Public keyset**: Enter the 'Keyset URL' from your Mahara connection. #. **Initiate login URL**: Enter the 'OpenID Connect login URL' from your Mahara connection. #. **Redirection URI(s)**: Enter the 'Redirect URLs' from your Mahara connection. #. **Tool configuration usage**: Select the option that suits your needs. The default is 'Show as preconfigured tool when adding an external tool'. #. **Default launch container**: Select 'New window' so that Mahara is opened in a new window or new tab. #. Click the *Save changes* button. .. note:: Deep linking and group provisioning has not yet been tested and is thus not documented. You can update the connection details at any point in time. .. figure:: /images/administration/external/moodle_external_tool_ltiadvantage_options.* :alt: Update the external tool options #. Click the *View configuration details* icon |moodle view config icon| to see LTI Advantage details that you need for Mahara. #. Click the *Edit* icon |moodle edit icon| to update the connection details. #. Click the *Delete* icon |moodle delete icon| to remove that connection from Moodle.